@mixd-id/web-scaffold 0.2.240705 → 0.2.250801009

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 (220) hide show
  1. package/docs/components/Dashboard.md +56 -0
  2. package/log.txt +7 -0
  3. package/package.json +27 -19
  4. package/src/components/404.vue +61 -0
  5. package/src/components/AccountIcon.vue +19 -0
  6. package/src/components/Ahref.vue +1 -1
  7. package/src/components/Alert.vue +4 -13
  8. package/src/components/ArrayList.vue +49 -0
  9. package/src/components/Article.vue +24 -30
  10. package/src/components/Button.vue +79 -167
  11. package/src/components/Card.vue +235 -0
  12. package/src/components/Carousel.vue +61 -60
  13. package/src/components/Cart.vue +192 -0
  14. package/src/components/CartIcon.vue +89 -0
  15. package/src/components/ChartBar.vue +2 -3
  16. package/src/components/Checkbox.vue +20 -11
  17. package/src/components/Checkout.vue +373 -0
  18. package/src/components/CheckoutDelivery.vue +267 -0
  19. package/src/components/CodeEditor.vue +5 -16
  20. package/src/components/CollapsiblePanel.vue +70 -0
  21. package/src/components/ColorPicker.vue +8 -3
  22. package/src/components/ColorPicker2.vue +41 -19
  23. package/src/components/ColorPicker3.vue +100 -0
  24. package/src/components/Confirm.vue +9 -7
  25. package/src/components/ContextMenu.vue +122 -206
  26. package/src/components/ContextMenuItem.vue +53 -0
  27. package/src/components/Dashboard.vue +243 -0
  28. package/src/components/Dashboard2.vue +118 -0
  29. package/src/components/DashboardComponentSelector.vue +96 -0
  30. package/src/components/DashboardConfigs.vue +202 -0
  31. package/src/components/Datepicker.vue +102 -41
  32. package/src/components/DayTimeRange.vue +3 -2
  33. package/src/components/Dropdown.vue +7 -4
  34. package/src/components/Flex.vue +14 -40
  35. package/src/components/GHeatMaps.vue +2 -2
  36. package/src/components/Grid.vue +6 -6
  37. package/src/components/HTMLEditor.vue +27 -14
  38. package/src/components/Image.vue +62 -108
  39. package/src/components/ImagePreview.vue +14 -4
  40. package/src/components/ImageUploader.vue +114 -0
  41. package/src/components/ImportModal.vue +3 -3
  42. package/src/components/Link.vue +62 -6
  43. package/src/components/List.vue +524 -402
  44. package/src/components/ListContextMenu.vue +88 -0
  45. package/src/components/ListItem.vue +5 -3
  46. package/src/components/ListPage1.vue +14 -15
  47. package/src/components/ListView.vue +5 -6
  48. package/src/components/ListViewSettings.vue +2 -2
  49. package/src/components/LogViewerItem.vue +1 -1
  50. package/src/components/MarkdownEdit.vue +128 -0
  51. package/src/components/MarkdownPreview.vue +102 -0
  52. package/src/components/MenuItem1.vue +36 -0
  53. package/src/components/Modal.vue +95 -43
  54. package/src/components/MultiDropdown.vue +124 -0
  55. package/src/components/MultilineText.vue +1 -4
  56. package/src/components/OTPField.vue +11 -17
  57. package/src/components/ObjectTree.vue +1 -1
  58. package/src/components/PageBuilder.vue +3 -3
  59. package/src/components/Paragraph.vue +1 -2
  60. package/src/components/PresetSelectorFilterItem.vue +107 -95
  61. package/src/components/Radio.vue +1 -1
  62. package/src/components/SearchModal.vue +153 -0
  63. package/src/components/Slider.vue +1 -1
  64. package/src/components/Svg.vue +1 -1
  65. package/src/components/SvgEditor.vue +173 -0
  66. package/src/components/Switch.vue +4 -5
  67. package/src/components/Table.vue +2 -2
  68. package/src/components/TableView.vue +2 -3
  69. package/src/components/TableViewHead.vue +2 -2
  70. package/src/components/Tabs.vue +1 -1
  71. package/src/components/Testimonial.vue +2 -2
  72. package/src/components/Text.vue +7 -22
  73. package/src/components/TextEditor.vue +3 -3
  74. package/src/components/TextWithTag.vue +61 -30
  75. package/src/components/Textarea.vue +11 -16
  76. package/src/components/Textbox.vue +9 -19
  77. package/src/components/Timepicker.vue +25 -15
  78. package/src/components/Toast.vue +5 -3
  79. package/src/components/TreeMenu.vue +122 -0
  80. package/src/components/TreeView.vue +15 -10
  81. package/src/components/TreeView2.vue +38 -0
  82. package/src/components/TreeViewItem.vue +58 -29
  83. package/src/components/TreeViewItem2.vue +55 -0
  84. package/src/components/Uploader.vue +45 -0
  85. package/src/components/Video.vue +119 -0
  86. package/src/components/VirtualGrid.vue +24 -7
  87. package/src/components/VirtualTable.vue +363 -128
  88. package/src/configs/dashboard/data-table.js +9 -0
  89. package/src/configs/web-page-builder.js +118 -0
  90. package/src/directives/intersect.js +26 -0
  91. package/src/hooks/device.js +14 -0
  92. package/src/index.js +62 -107
  93. package/src/mixin/component.js +147 -67
  94. package/src/themes/default/index.js +83 -155
  95. package/src/utils/dashboard.js +22 -962
  96. package/src/utils/helpers.cjs +635 -0
  97. package/src/utils/helpers.js +91 -60
  98. package/src/utils/helpers.mjs +245 -12
  99. package/src/utils/importer.js +22 -3
  100. package/src/utils/list.mjs +1509 -0
  101. package/src/utils/preset-selector.cjs +1455 -0
  102. package/src/utils/preset-selector.js +489 -95
  103. package/src/utils/preset-selector.mjs +59 -20
  104. package/src/utils/queue.js +63 -0
  105. package/src/utils/web.mjs +120 -0
  106. package/src/utils/wss.js +37 -29
  107. package/src/utils/wss.mjs +24 -19
  108. package/src/widgets/AhrefSetting.vue +16 -13
  109. package/src/widgets/ArticleSetting.vue +15 -27
  110. package/src/widgets/BackgroundColorSetting.vue +153 -0
  111. package/src/widgets/BorderColorSetting.vue +57 -0
  112. package/src/widgets/BotEditor/BotEditorActions.vue +3 -2
  113. package/src/widgets/BotEditor/BotEditorSettings.vue +21 -0
  114. package/src/widgets/BotEditor.vue +35 -15
  115. package/src/widgets/ButtonSetting.vue +12 -13
  116. package/src/widgets/CarouselSetting.vue +33 -45
  117. package/src/widgets/CartSetting.vue +46 -0
  118. package/src/widgets/CheckoutSetting.vue +46 -0
  119. package/src/widgets/CollapsiblePanelSetting.vue +46 -0
  120. package/src/widgets/ColumnSelector.vue +29 -5
  121. package/src/widgets/ComponentSetting.vue +1 -1
  122. package/src/widgets/ComponentSetting2.vue +112 -234
  123. package/src/widgets/ComponentSetting3.vue +1 -1
  124. package/src/widgets/ContactForm.vue +3 -3
  125. package/src/widgets/ContactFormSetting.vue +41 -30
  126. package/src/widgets/Dashboard/BarChart.vue +47 -11
  127. package/src/widgets/Dashboard/BarChartSetting.vue +1 -1
  128. package/src/widgets/Dashboard/DataTable.vue +125 -0
  129. package/src/widgets/Dashboard/DataTableSetting.vue +243 -0
  130. package/src/widgets/Dashboard/DatasourceSelector.vue +1 -1
  131. package/src/widgets/Dashboard/Doughnut.vue +49 -7
  132. package/src/widgets/Dashboard/DoughnutSetting.vue +2 -2
  133. package/src/widgets/Dashboard/Metric.vue +78 -19
  134. package/src/widgets/Dashboard/MetricSetting.vue +81 -28
  135. package/src/widgets/Dashboard/Pie.vue +55 -6
  136. package/src/widgets/Dashboard/PieSetting.vue +1 -1
  137. package/src/widgets/Dashboard/PolarArea.vue +49 -7
  138. package/src/widgets/Dashboard/PolarAreaSetting.vue +1 -1
  139. package/src/widgets/Dashboard/SharingModal.vue +4 -5
  140. package/src/widgets/Dashboard/ViewSelector.vue +2 -2
  141. package/src/widgets/Dashboard/VirtualTableSetting.vue +121 -184
  142. package/src/widgets/{Dashboard.vue → Dashboard0.vue} +426 -343
  143. package/src/widgets/EmbeddedVideoSetting.vue +7 -5
  144. package/src/widgets/FAQ.vue +16 -3
  145. package/src/widgets/FAQSetting.vue +53 -47
  146. package/src/widgets/FeatureList.vue +3 -0
  147. package/src/widgets/FeatureListSetting.vue +112 -102
  148. package/src/widgets/FlexSetting.vue +83 -106
  149. package/src/widgets/GridSetting.vue +71 -196
  150. package/src/widgets/Header2.vue +34 -71
  151. package/src/widgets/Header2Setting.vue +95 -179
  152. package/src/widgets/HeaderSetting.vue +16 -18
  153. package/src/widgets/IconListSetting.vue +69 -65
  154. package/src/widgets/ImageSetting.vue +33 -60
  155. package/src/widgets/LinkSetting.vue +60 -37
  156. package/src/widgets/LinkSettingModal.vue +173 -0
  157. package/src/widgets/LogViewer.vue +1 -1
  158. package/src/widgets/MarginSetting.vue +2 -2
  159. package/src/widgets/MenuEditor.vue +1 -1
  160. package/src/widgets/MenuItem1Setting.vue +78 -0
  161. package/src/widgets/ModalSetting.vue +42 -44
  162. package/src/widgets/MultiValueSetting.vue +2 -2
  163. package/src/widgets/MultiValueSetting2.vue +78 -45
  164. package/src/widgets/OGSettingModal.vue +103 -0
  165. package/src/widgets/PaddingSetting.vue +2 -2
  166. package/src/widgets/ParagraphSetting.vue +16 -13
  167. package/src/widgets/PositionSetting.vue +209 -0
  168. package/src/widgets/PresetBar.vue +359 -210
  169. package/src/widgets/PresetBarPivot.vue +31 -19
  170. package/src/widgets/PresetSelector.vue +29 -17
  171. package/src/widgets/SearchModalSetting.vue +70 -0
  172. package/src/widgets/Share.vue +1 -2
  173. package/src/widgets/ShareSetting.vue +67 -60
  174. package/src/widgets/StyleSetting.vue +227 -116
  175. package/src/widgets/TestimonialSetting.vue +97 -88
  176. package/src/widgets/TextBlockSetting.vue +16 -13
  177. package/src/widgets/UserActionBuilder/UserActionConsole.vue +30 -10
  178. package/src/widgets/UserActionBuilder/UserActionOutput.vue +2 -2
  179. package/src/widgets/UserActionBuilder/UserActionOutputReply.vue +64 -87
  180. package/src/widgets/UserActionBuilder/UserActionProps.vue +3 -3
  181. package/src/widgets/UserActionBuilder.vue +4 -16
  182. package/src/widgets/WebComponentSelector.vue +15 -11
  183. package/src/widgets/WebLayoutSelector.vue +41 -270
  184. package/src/widgets/WebPageBuilder.vue +693 -704
  185. package/src/widgets/WebPageBuilder2.vue +7 -7
  186. package/src/widgets/WebPageBuilder4/ButtonSetting.vue +0 -8
  187. package/src/widgets/WebPageBuilder4/CarouselSetting.vue +63 -7
  188. package/src/widgets/WebPageBuilder4/FlexAlignSetting.vue +3 -3
  189. package/src/widgets/WebPageBuilder4/FlexSetting.vue +1 -10
  190. package/src/widgets/WebPageBuilder4/MultiValueSetting.vue +2 -2
  191. package/src/widgets/WebPageBuilder4/PropertySetting.vue +0 -7
  192. package/src/widgets/WebPageBuilder4/WebPageComponentSelector.vue +1 -7
  193. package/src/widgets/WebPageBuilder4.vue +289 -575
  194. package/src/widgets/WebPageSelector.vue +1 -1
  195. package/src/widgets/YoutubeVideoSetting.vue +16 -13
  196. package/tailwind.config.js +3 -35
  197. package/docs/schema/user-action.json +0 -266
  198. package/src/App.vue +0 -25
  199. package/src/components/SearchButton.vue +0 -57
  200. package/src/entry-client.js +0 -27
  201. package/src/entry-server.js +0 -73
  202. package/src/events/event.js +0 -2
  203. package/src/main.js +0 -29
  204. package/src/mixin/website.js +0 -121
  205. package/src/router.js +0 -57
  206. package/src/widgets/MobileMenu.vue +0 -182
  207. package/src/widgets/WebPageBuilder4/ActionSetting.vue +0 -158
  208. package/src/widgets/WebPageBuilder4/ColorSetting.vue +0 -63
  209. package/src/widgets/WebPageBuilder4/DataSetting.vue +0 -92
  210. package/src/widgets/WebPageBuilder4/FontSizeSetting.vue +0 -76
  211. package/src/widgets/WebPageBuilder4/LinkSetting.vue +0 -68
  212. package/src/widgets/WebPageBuilder4/MobileMenuSetting.vue +0 -106
  213. package/src/widgets/WebPageBuilder4/Setting.vue +0 -73
  214. package/src/widgets/WebPageBuilder4/StyleSetting.vue +0 -77
  215. package/src/widgets/WebPageBuilder4/SvgSetting.vue +0 -207
  216. package/src/widgets/WebPageBuilder4/TextTransformSetting.vue +0 -70
  217. package/src/widgets/WebPageBuilder4/WebPageDataEdit.vue +0 -121
  218. package/test.json +0 -22
  219. /package/src/widgets/{Header1.vue → Header0.vue} +0 -0
  220. /package/src/widgets/{Header1Setting.vue → Header0Setting.vue} +0 -0
@@ -18,10 +18,11 @@
18
18
 
19
19
  <script>
20
20
 
21
- import {Doughnut} from 'vue-chartjs'
21
+ import { Doughnut } from 'vue-chartjs'
22
+ import Chart from 'chart.js/auto'
22
23
  import {color} from "chart.js/helpers";
23
24
  import {strVars} from "../../utils/helpers.mjs";
24
- import {readyStateMixin} from "../../mixin/ready-state";
25
+ import {useEmitter} from "../../utils/event-bus";
25
26
 
26
27
  export default{
27
28
 
@@ -92,14 +93,43 @@ export default{
92
93
  '#FFCE54',
93
94
  '#ED5565',
94
95
  '#EC87C0'
95
- ]
96
+ ],
97
+ readyState: 1,
98
+ value: null,
96
99
  }
97
100
  },
98
101
 
99
- inject: [ 'selectPreset' ],
102
+ inject: [ 'getSrc', 'getViewedPreset', 'getQueryFilters', 'selectPreset', 'socket' ],
100
103
 
101
104
  methods: {
102
105
 
106
+ load(){
107
+ const preset = this.getViewedPreset()
108
+ const {name, datasource} = preset
109
+
110
+ this.readyState = 2
111
+ this.socket.send(this.getSrc(), {
112
+ name,
113
+ views: [{
114
+ ...this.$props,
115
+ type: 'Doughnut'
116
+ }],
117
+ datasource: datasource.map(_datasource => {
118
+ return {
119
+ ..._datasource,
120
+ filters: [
121
+ ...(_datasource.filters ?? []),
122
+ ...(this.getQueryFilters()[_datasource.uid] ?? [])
123
+ ]
124
+ }
125
+ })
126
+ })
127
+ .then(_ => {
128
+ this.value = _[this.uid]
129
+ })
130
+ .finally(_ => this.readyState = 1)
131
+ },
132
+
103
133
  onClick(e, segments){
104
134
 
105
135
  const clickInteractions = (this.interactions ?? []).filter(_ => _.event === 'click')
@@ -134,15 +164,27 @@ export default{
134
164
 
135
165
  },
136
166
 
137
- mixins: [ readyStateMixin ],
167
+ mounted() {
168
+ this.load()
169
+
170
+ this.emitter = useEmitter()
171
+ this.emitter.on(`${this.uid}.load`, () => {
172
+ this.load()
173
+ })
174
+ this.emitter.on(`dashboard.load`, () => {
175
+ this.load()
176
+ })
177
+ },
138
178
 
139
179
  props: {
140
180
 
141
181
  label: String,
142
182
 
143
- value: Object,
144
-
145
183
  column: String,
184
+ columnModifier: String,
185
+
186
+ rows: String,
187
+ rowsModifier: String,
146
188
 
147
189
  datasourceUid: String,
148
190
 
@@ -11,7 +11,7 @@
11
11
  <Dropdown class="min-w-[150px]"
12
12
  :readonly="readonly"
13
13
  v-model="value.props.datasourceUid"
14
- @change="delete value.props.columns;">
14
+ @change="delete value.props.columns; $emit('change')">
15
15
  <option disabled selected>Select Datasource</option>
16
16
  <option v-for="obj in datasource"
17
17
  :value="obj.uid">
@@ -95,7 +95,7 @@
95
95
  <div class="mt-1">
96
96
  <ListItem :items="interactions"
97
97
  class="rounded-xl"
98
- container-class="flex flex-col divide-y divide-text-50"
98
+ container-class="flex flex-col divide-y divide-border-50"
99
99
  @reorder="(from, to) => { interactions.splice(to, 0, interactions.splice(from, 1)[0]); }">
100
100
  <template v-slot="{ item, index }">
101
101
  <div class="flex flex-row items-center gap-3 px-3">
@@ -1,17 +1,24 @@
1
1
  <template>
2
- <div :class="$style.comp">
2
+ <div :class="$style.comp" v-if="metric">
3
3
  <label class="text-text-400 text-ellipsis overflow-hidden whitespace-nowrap">{{ label }}</label>
4
- <div class="flex flex-row gap-2">
5
- <h1 v-if="readyState === 1" class="text-ellipsis overflow-hidden whitespace-nowrap" :class="column2Enabled ? '' : 'text-green-600'">
6
- {{ cValue }}
4
+ <div class="flex flex-row items-end gap-2">
5
+ <h1 v-if="readyState === 1" class="text-5xl text-ellipsis overflow-hidden whitespace-nowrap" :class="column2Enabled ? '' : 'text-green-600'">
6
+ {{ metric.value }}
7
7
  </h1>
8
8
  <h1 v-else class="text-ellipsis overflow-hidden whitespace-nowrap text-text-300">
9
9
  Loading...
10
10
  </h1>
11
11
 
12
- <div class="flex flex-col" v-if="column2Enabled && readyState === 1">
13
- <div class="text-sm text-ellipsis whitespace-nowrap overflow-hidden" :class="value?.comparedPercent <= 50 ? 'text-red-600' : 'text-green-600'">{{ value?.comparedPercent }}%</div>
14
- <div class="text-sm text-ellipsis whitespace-nowrap overflow-hidden">{{ ccValue }}</div>
12
+ <div class="flex flex-col">
13
+ <div class=" text-ellipsis whitespace-nowrap overflow-hidden"
14
+ :class="showPercentage ? '' : 'text-green-600'">
15
+ {{ metric.comparedValue }}
16
+ </div>
17
+
18
+ <div class="text-sm text-ellipsis whitespace-nowrap overflow-hidden"
19
+ :class="metric.comparedPercent <= 50 ? 'text-red-600' : 'text-green-600'">
20
+ {{ metric.comparedPercent }}%
21
+ </div>
15
22
  </div>
16
23
  </div>
17
24
  </div>
@@ -19,32 +26,48 @@
19
26
 
20
27
  <script>
21
28
 
22
- import {readyStateMixin} from "../../mixin/ready-state";
29
+ import dayjs from "dayjs";
23
30
 
24
31
  export default{
25
32
 
26
33
  computed: {
27
34
 
28
35
  cValue(){
29
- let value = parseFloat(this.value?.value)
30
- if(isNaN(value)) return 'N/A'
31
- return value.toLocaleString()
36
+ if(!this.column) return 'N/A'
37
+ const column = this.datasource?.columns.find(_ => _.key === this.column)
38
+ return this.getValue(this.value?.value, column)
32
39
  },
33
40
 
34
41
  ccValue(){
35
42
  if(!this.column2Enabled) return
43
+ if(!this.value?.comparedValue) return
44
+
45
+ const column = this.datasource?.columns.find(_ => _.key === this.column2)
46
+ return this.getValue(this.value?.comparedValue, column)
47
+ },
36
48
 
37
- let value = parseFloat(this.value?.comparedValue)
38
- if(isNaN(value)) return 'N/A'
39
- return value.toLocaleString()
49
+ datasource(){
50
+ const preset = this.getViewedPreset()
51
+ if(preset){
52
+ return preset.datasource.find(_ => _.uid === this.datasourceUid)
53
+ }
40
54
  }
41
55
 
42
56
  },
43
57
 
44
- mixins: [ readyStateMixin ],
58
+ data(){
59
+ return {
60
+ metric: null,
61
+ readyState: 1,
62
+ }
63
+ },
64
+
65
+ inject: [ 'getController', 'getViewedPreset', 'getQueryFilters', 'socket' ],
45
66
 
46
67
  props: {
47
68
 
69
+ label: String,
70
+
48
71
  column: String,
49
72
  columnModifier: String,
50
73
 
@@ -54,12 +77,48 @@ export default{
54
77
 
55
78
  datasourceUid: String,
56
79
 
57
- label: String,
80
+ showPercentage: [ Number, Boolean ],
81
+
82
+ uid: String
83
+
84
+ },
58
85
 
59
- value: Object,
86
+ methods: {
60
87
 
61
- uid: String,
88
+ getValue(val, column){
89
+ let value
90
+
91
+ switch(column?.type){
92
+
93
+ case 'date':
94
+ value = dayjs(val).format('D MMM')
95
+ break
96
+
97
+ default:
98
+ value = parseFloat(val)
99
+ value = isNaN(value) ?
100
+ 'N/A' :
101
+ value.toLocaleString()
102
+ }
103
+
104
+ return value
105
+ },
106
+
107
+ load(){
108
+
109
+ this.readyState = 2
110
+ this.socket.send(`${this.getController()}.load-metric`, {})
111
+ .then(metric => {
112
+ this.metric = metric
113
+ })
114
+ .finally(_ => this.readyState = 1)
115
+
116
+ },
117
+
118
+ },
62
119
 
120
+ mounted() {
121
+ this.load()
63
122
  }
64
123
 
65
124
  }
@@ -69,7 +128,7 @@ export default{
69
128
  <style module>
70
129
 
71
130
  .comp{
72
- @apply border-[1px] border-text-50 bg-base-500 rounded-xl overflow-hidden;
131
+ @apply border-[1px] border-border-50 bg-base-500 rounded-xl overflow-hidden;
73
132
  @apply p-3 flex flex-col gap-1;
74
133
  }
75
134
 
@@ -1,7 +1,7 @@
1
1
  <template>
2
- <div class="flex flex-col gap-5 p-6">
2
+ <div class="flex flex-col gap-8 p-6">
3
3
 
4
- <div class="flex flex-row items-center">
4
+ <div class="flex flex-row items-center" @click="log(value)">
5
5
  <label class="flex-1">Active</label>
6
6
  <Switch v-model="value.props.enabled" :readonly="readonly" @change="$emit('change')" />
7
7
  </div>
@@ -15,7 +15,7 @@
15
15
  <Dropdown class="min-w-[150px]"
16
16
  :readonly="readonly"
17
17
  v-model="value.props.datasourceUid"
18
- @change="delete value.props.columns">
18
+ @change="delete value.props.columns;$emit('change')">
19
19
  <option v-for="obj in datasource"
20
20
  :value="obj.uid">
21
21
  {{ obj.name }}
@@ -28,25 +28,13 @@
28
28
  <Textbox v-model="value.props.label"
29
29
  maxlength="30"
30
30
  placeholder="Label"
31
- :readonly="readonly"
32
- @keyup.enter="$emit('change')"
33
- @blur="$emit('change')" />
31
+ :readonly="readonly" />
34
32
  </div>
35
33
 
36
- <div v-if="value.props.datasourceUid" class="flex flex-col gap-5">
34
+ <div v-if="value.props.datasourceUid" class="flex flex-col gap-8">
37
35
  <div class="flex flex-col gap-1">
38
36
  <label class="flex-1">Column</label>
39
37
  <div class="flex flex-row gap-2">
40
- <Dropdown class="min-w-[150px] flex-1"
41
- :readonly="readonly"
42
- v-model="value.props.column"
43
- @change="$emit('change')">
44
- <option v-for="column in selectedDatasourceColumns"
45
- :value="column.key">
46
- {{ selectedDatasource.pivot?.enabled ? column.key : column.label }}
47
- </option>
48
- </Dropdown>
49
-
50
38
  <Dropdown class="w-[125px]"
51
39
  :readonly="readonly"
52
40
  v-model="value.props.columnModifier"
@@ -60,6 +48,16 @@
60
48
  <option value="first">First</option>
61
49
  <option value="last">Last</option>
62
50
  </Dropdown>
51
+
52
+ <Dropdown class="min-w-[150px] flex-1"
53
+ :readonly="readonly"
54
+ v-model="value.props.column"
55
+ @change="$emit('change')">
56
+ <option v-for="column in selectedDatasourceColumns"
57
+ :value="column.key">
58
+ {{ selectedDatasource.pivot?.enabled ? column.key : column.label }}
59
+ </option>
60
+ </Dropdown>
63
61
  </div>
64
62
  </div>
65
63
 
@@ -70,16 +68,6 @@
70
68
  </Checkbox>
71
69
  </div>
72
70
  <div class="flex flex-row gap-2">
73
- <Dropdown class="min-w-[150px] flex-1"
74
- :readonly="readonly || !value.props.column2Enabled"
75
- v-model="value.props.column2"
76
- @change="$emit('change')">
77
- <option v-for="column in selectedDatasourceColumns"
78
- :value="column.key">
79
- {{ selectedDatasource.pivot?.enabled ? column.key : column.label }}
80
- </option>
81
- </Dropdown>
82
-
83
71
  <Dropdown class="w-[125px]"
84
72
  :readonly="readonly || !value.props.column2Enabled"
85
73
  v-model="value.props.column2Modifier"
@@ -93,6 +81,32 @@
93
81
  <option value="first">First</option>
94
82
  <option value="last">Last</option>
95
83
  </Dropdown>
84
+
85
+ <Dropdown class="min-w-[150px] flex-1"
86
+ :readonly="readonly || !value.props.column2Enabled"
87
+ v-model="value.props.column2"
88
+ @change="$emit('change')">
89
+ <option v-for="column in selectedDatasourceColumns"
90
+ :value="column.key">
91
+ {{ selectedDatasource.pivot?.enabled ? column.key : column.label }}
92
+ </option>
93
+ </Dropdown>
94
+ </div>
95
+ </div>
96
+
97
+ <div class="flex flex-col gap-2" v-if="canShowPercentage">
98
+ <div>
99
+ <Checkbox v-model="value.props.showPercentage" :disabled="readonly">
100
+ Show Percentage
101
+ </Checkbox>
102
+ </div>
103
+ <div class="flex flex-row gap-2">
104
+ <Dropdown class="w-full"
105
+ :readonly="readonly || !value.props.column2Enabled"
106
+ v-model="value.props.showPercentageOpt"
107
+ @change="$emit('change')">
108
+ <option v-for="arr in showPercentageOptValues" :value="arr[0]">{{ arr[1] }}</option>
109
+ </Dropdown>
96
110
  </div>
97
111
  </div>
98
112
 
@@ -113,8 +127,47 @@ export default{
113
127
 
114
128
  computed: {
115
129
 
130
+ column1(){
131
+ if(!this.value || !this.value.props.column) return
132
+ return this.selectedDatasource.columns.find(_ => _.key === this.value.props.column)
133
+ },
134
+
135
+ column2(){
136
+ if(!this.value || !this.value.props.column2) return
137
+ return this.selectedDatasource.columns.find(_ => _.key === this.value.props.column2)
138
+ },
139
+
140
+ canShowPercentage(){
141
+ return this.column1 && this.column2 && this.column1.type === this.column2.type
142
+ },
143
+
116
144
  selectedDatasource(){
117
- return this.datasource.find(d => d.uid === this.value.props.datasourceUid)
145
+ //return this.datasource.find(d => d.uid === this.value.props.datasourceUid)
146
+ },
147
+
148
+ showPercentageOptValues(){
149
+ if(!this.canShowPercentage) return
150
+
151
+ switch(this.column1.type){
152
+
153
+ case 'date':
154
+ return [
155
+ [ 'day', 'Day' ],
156
+ [ 'hour', 'Hour' ],
157
+ [ 'minute', 'Minute' ],
158
+ [ 'month', 'Month' ],
159
+ [ 'week', 'Week' ],
160
+ [ 'year', 'Year' ],
161
+ ]
162
+
163
+ case 'number':
164
+ default:
165
+ return [
166
+ [ 'percentage', 'Percentage' ],
167
+ [ 'number', 'Number' ],
168
+ ]
169
+
170
+ }
118
171
  },
119
172
 
120
173
  selectedDatasourceColumns(){
@@ -18,10 +18,11 @@
18
18
 
19
19
  <script>
20
20
 
21
- import {Pie} from 'vue-chartjs'
22
- import {color} from 'chart.js/helpers'
21
+ import { Pie } from 'vue-chartjs'
22
+ import Chart from 'chart.js/auto'
23
+ import { color } from 'chart.js/helpers'
23
24
  import {strVars} from "../../utils/helpers.mjs";
24
- import {readyStateMixin} from "../../mixin/ready-state";
25
+ import {useEmitter} from "../../utils/event-bus";
25
26
 
26
27
  export default{
27
28
 
@@ -78,10 +79,44 @@ export default{
78
79
 
79
80
  },
80
81
 
81
- inject: [ 'selectPreset' ],
82
+ data(){
83
+ return {
84
+ readyState: 1,
85
+ value: null,
86
+ }
87
+ },
88
+
89
+ inject: [ 'getSrc', 'getViewedPreset', 'getQueryFilters', 'selectPreset', 'socket' ],
82
90
 
83
91
  methods: {
84
92
 
93
+ load(){
94
+ const preset = this.getViewedPreset()
95
+ const {name, datasource} = preset
96
+
97
+ this.readyState = 2
98
+ this.socket.send(this.getSrc(), {
99
+ name,
100
+ views: [{
101
+ ...this.$props,
102
+ type: 'Pie'
103
+ }],
104
+ datasource: datasource.map(_datasource => {
105
+ return {
106
+ ..._datasource,
107
+ filters: [
108
+ ...(_datasource.filters ?? []),
109
+ ...(this.getQueryFilters()[_datasource.uid] ?? [])
110
+ ]
111
+ }
112
+ })
113
+ })
114
+ .then(_ => {
115
+ this.value = _[this.uid]
116
+ })
117
+ .finally(_ => this.readyState = 1)
118
+ },
119
+
85
120
  onClick(e, segments){
86
121
 
87
122
  const clickInteractions = (this.interactions ?? []).filter(_ => _.event === 'click')
@@ -116,7 +151,17 @@ export default{
116
151
 
117
152
  },
118
153
 
119
- mixins: [ readyStateMixin ],
154
+ mounted() {
155
+ this.load()
156
+
157
+ this.emitter = useEmitter()
158
+ this.emitter.on(`${this.uid}.load`, () => {
159
+ this.load()
160
+ })
161
+ this.emitter.on(`dashboard.load`, () => {
162
+ this.load()
163
+ })
164
+ },
120
165
 
121
166
  props: {
122
167
 
@@ -124,7 +169,11 @@ export default{
124
169
 
125
170
  value: Object,
126
171
 
127
- column: Object,
172
+ column: String,
173
+ columnModifier: String,
174
+
175
+ rows: String,
176
+ rowsModifier: String,
128
177
 
129
178
  datasourceUid: String,
130
179
 
@@ -136,7 +136,7 @@
136
136
  <div class="mt-1">
137
137
  <ListItem :items="interactions"
138
138
  class="rounded-xl"
139
- container-class="flex flex-col divide-y divide-text-50"
139
+ container-class="flex flex-col divide-y divide-border-50"
140
140
  @reorder="(from, to) => { interactions.splice(to, 0, interactions.splice(from, 1)[0]); }">
141
141
  <template v-slot="{ item, index }">
142
142
  <div class="flex flex-row items-center gap-3 px-3">
@@ -16,10 +16,11 @@
16
16
 
17
17
  <script>
18
18
 
19
- import {PolarArea} from 'vue-chartjs'
20
- import {color} from 'chart.js/helpers'
19
+ import { PolarArea } from 'vue-chartjs'
20
+ import Chart from 'chart.js/auto'
21
+ import { color } from 'chart.js/helpers'
21
22
  import {strVars} from "../../utils/helpers.mjs";
22
- import {readyStateMixin} from "../../mixin/ready-state";
23
+ import {useEmitter} from "../../utils/event-bus";
23
24
 
24
25
  export default{
25
26
 
@@ -95,13 +96,42 @@ export default{
95
96
  '#ED5565',
96
97
  '#EC87C0'
97
98
  ],
99
+ readyState: 1,
100
+ value: null,
98
101
  }
99
102
  },
100
103
 
101
- inject: [ 'selectPreset' ],
104
+ inject: [ 'getSrc', 'getViewedPreset', 'getQueryFilters', 'selectPreset', 'socket' ],
102
105
 
103
106
  methods: {
104
107
 
108
+ load(){
109
+ const preset = this.getViewedPreset()
110
+ const {name, datasource} = preset
111
+
112
+ this.readyState = 2
113
+ this.socket.send(this.getSrc(), {
114
+ name,
115
+ views: [{
116
+ ...this.$props,
117
+ type: 'PolarArea'
118
+ }],
119
+ datasource: datasource.map(_datasource => {
120
+ return {
121
+ ..._datasource,
122
+ filters: [
123
+ ...(_datasource.filters ?? []),
124
+ ...(this.getQueryFilters()[_datasource.uid] ?? [])
125
+ ]
126
+ }
127
+ })
128
+ })
129
+ .then(_ => {
130
+ this.value = _[this.uid]
131
+ })
132
+ .finally(_ => this.readyState = 1)
133
+ },
134
+
105
135
  onClick(e, segments){
106
136
 
107
137
  const clickInteractions = (this.interactions ?? []).filter(_ => _.event === 'click')
@@ -136,15 +166,27 @@ export default{
136
166
 
137
167
  },
138
168
 
139
- mixins: [ readyStateMixin ],
169
+ mounted() {
170
+ this.load()
171
+
172
+ this.emitter = useEmitter()
173
+ this.emitter.on(`${this.uid}.load`, () => {
174
+ this.load()
175
+ })
176
+ this.emitter.on(`dashboard.load`, () => {
177
+ this.load()
178
+ })
179
+ },
140
180
 
141
181
  props: {
142
182
 
143
183
  label: String,
144
184
 
145
- value: Object,
146
-
147
185
  column: String,
186
+ columnModifier: String,
187
+
188
+ rows: String,
189
+ rowsModifier: String,
148
190
 
149
191
  datasourceUid: String,
150
192
 
@@ -94,7 +94,7 @@
94
94
  <div class="mt-1">
95
95
  <ListItem :items="interactions"
96
96
  class="rounded-xl"
97
- container-class="flex flex-col divide-y divide-text-50"
97
+ container-class="flex flex-col divide-y divide-border-50"
98
98
  @reorder="(from, to) => { interactions.splice(to, 0, interactions.splice(from, 1)[0]); }">
99
99
  <template v-slot="{ item, index }">
100
100
  <div class="flex flex-row items-center gap-3 px-3">
@@ -32,7 +32,7 @@
32
32
  <div class="flex-1 p-6 flex flex-col">
33
33
 
34
34
  <div v-if="items?.length > 0">
35
- <div v-for="item in items" :class="$style.button" @click="select(item)">
35
+ <div v-for="item in items" :class="appStyle.menuItem" @click="select(item)">
36
36
  <slot name="item" :item="item">
37
37
  <div>{{ item.name }}</div>
38
38
  </slot>
@@ -55,7 +55,7 @@ export default{
55
55
 
56
56
  emits: [ 'select' ],
57
57
 
58
- inject: [ 'socket', 'toast' ],
58
+ inject: [ 'appStyle', 'socket', 'toast' ],
59
59
 
60
60
  name: 'SharingModal',
61
61
 
@@ -108,9 +108,8 @@ export default{
108
108
 
109
109
  <style module>
110
110
 
111
- .button{
112
- @apply text-left p-3 border-[1px] border-transparent rounded-lg cursor-pointer;
113
- @apply hover:border-primary-300 hover:bg-primary-100;
111
+ .comp{
112
+
114
113
  }
115
114
 
116
115
  </style>
@@ -101,7 +101,7 @@ export default{
101
101
  { type:"Pie", name:"Pie", group:"components", import: () => import('../../configs/dashboard/pie.js'), thumbnailUrl:"/static/dashboard/pie.png" },
102
102
  { type:"Doughnut", name:"Doughnut", group:"components", import: () => import('../../configs/dashboard/doughnut.js'), thumbnailUrl:"/static/dashboard/doughnut.png" },
103
103
  { type:"PolarArea", name:"Polar Area", group:"components", import: () => import('../../configs/dashboard/polar-area.js'), thumbnailUrl:"/static/dashboard/polar-area.png" },
104
- { type:"VirtualTable", name:"Table", group:"components", import: () => import('../../configs/dashboard/virtual-table.js'), thumbnailUrl:"/static/dashboard/virtual-table.png" },
104
+ { type:"DataTable", name:"DataTable", group:"components", import: () => import('../../configs/dashboard/data-table.js'), thumbnailUrl:"/static/dashboard/virtual-table.png" },
105
105
  { type:"Metric", name:"Metric", group:"components", import: () => import('../../configs/dashboard/metric.js'), thumbnailUrl:"/static/dashboard/metric.png" },
106
106
  { type:"BarChart", name:"Bar Chart", group:"components", import: () => import('../../configs/dashboard/bar.js'), thumbnailUrl:"/static/dashboard/bar.png" },
107
107
  { type:"GHeatMaps", name:"Heat Map", group:"components", import: () => import('../../configs/dashboard/gheatmaps.js'), thumbnailUrl:"/static/dashboard/gheatmaps.png" },
@@ -176,7 +176,7 @@ export default{
176
176
 
177
177
  .button{
178
178
  @apply flex flex-col gap-2 items-center rounded-xl p-3;
179
- @apply hover:bg-text-50 border-[1px] border-transparent hover:border-text-200;
179
+ @apply hover:bg-text-50 border-[1px] border-transparent hover:border-border-200;
180
180
  }
181
181
 
182
182