@mixd-id/web-scaffold 0.2.240706 → 0.2.250801010

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 +83 -169
  11. package/src/components/Card.vue +257 -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 +12 -5
  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 +528 -403
  44. package/src/components/ListContextMenu.vue +88 -0
  45. package/src/components/ListItem.vue +6 -4
  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 +40 -26
  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 +16 -22
  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 +151 -67
  94. package/src/themes/default/index.js +118 -159
  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 +38 -36
  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 +145 -236
  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 +365 -150
  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 +1019 -707
  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
@@ -1,7 +1,7 @@
1
1
  <template>
2
2
  <div :class="$style.comp">
3
3
 
4
- <div>
4
+ <div class="p-6 py-4">
5
5
  <div class="flex flex-col gap-8">
6
6
  <div class="flex flex-col gap-1">
7
7
  <label class="flex-1 text-text-400">Text</label>
@@ -19,11 +19,12 @@
19
19
  Add Field
20
20
  </button>
21
21
  </div>
22
- <ListItem :items="item.props.fields" class="mt-2 border-text-200 border-[1px] rounded-lg overflow-hidden"
23
- bodyClass="flex flex-col gap-1 divide-y divide-text-200"
22
+ <ListItem :items="item.props.fields"
23
+ class="mt-1 border-border-200 border-[1px] bg-base-300 rounded-lg overflow-hidden"
24
+ container-class="divide-y divide-border-50"
24
25
  @reorder="(from, to) => { item.props.fields.splice(to, 0, item.props.fields.splice(from, 1)[0]); $emit('change') }">
25
26
  <template v-slot="{ item:field, index }">
26
- <div class="flex flex-row items-center gap-2 px-3 bg-base-500">
27
+ <div class="flex flex-row items-center gap-2 px-3">
27
28
  <svg data-reorder width="14" height="14" class="fill-text-300" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path d="M496 288H16c-8.8 0-16 7.2-16 16v32c0 8.8 7.2 16 16 16h480c8.8 0 16-7.2 16-16v-32c0-8.8-7.2-16-16-16zm0-128H16c-8.8 0-16 7.2-16 16v32c0 8.8 7.2 16 16 16h480c8.8 0 16-7.2 16-16v-32c0-8.8-7.2-16-16-16z"/></svg>
28
29
  <div>
29
30
  <Checkbox v-model="field.required" @change="$emit('change')"/>
@@ -43,16 +44,17 @@
43
44
  <div>
44
45
  <div class="flex flex-row gap-4">
45
46
  <label class="flex-1 text-text-400">On Submit</label>
46
- <button type="button" class="text-primary"
47
- @click="(e) => $refs.actionOpt.open(e.target)">
47
+ <button ref="actionBtn" type="button" class="text-primary"
48
+ @click="(e) => $refs.actionOpt.open($refs.actionBtn)">
48
49
  Add Action
49
50
  </button>
50
51
  </div>
51
- <ListItem :items="item.props.onSubmit" class="mt-2" bodyClass="flex flex-col gap-1"
52
- @reorder="(from, to) => { item.props.onSubmit.splice(to, 0, item.props.onSubmit.splice(from, 1)[0]); $emit('change') }">
52
+ <ListItem :items="onSubmit"
53
+ class="mt-1 bg-base-300 border-[1px] border-border-200 rounded-lg"
54
+ container-class="divide-y divide-border-50">
53
55
  <template v-slot="{ item:action, index }">
54
56
  <div v-if="action.type === 'send-whatsapp'">
55
- <div v-if="action._edit" class="flex flex-row items-start gap-2 p-3 bg-base-500 rounded-lg">
57
+ <div v-if="action._edit" class="flex flex-row items-start gap-2 p-3">
56
58
  <div class="flex-1 flex flex-col gap-2">
57
59
  <label class="text-text-400 leading-1">Send whatsapp to</label>
58
60
  <div class="flex flex-row gap-2">
@@ -78,7 +80,7 @@
78
80
  </div>
79
81
 
80
82
  <div v-else-if="action.type === 'send-whatsapp-referral'">
81
- <div class="flex flex-row items-center gap-2 p-3 bg-base-500 rounded-lg">
83
+ <div class="flex flex-row items-center gap-2 p-3 bg-base-300">
82
84
  <div class="flex-1 flex flex-row gap-2 items-center">
83
85
  <svg width="14" height="14" class="fill-text" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path d="M380.9 97.1C339 55.1 283.2 32 223.9 32c-122.4 0-222 99.6-222 222 0 39.1 10.2 77.3 29.6 111L0 480l117.7-30.9c32.4 17.7 68.9 27 106.1 27h.1c122.3 0 224.1-99.6 224.1-222 0-59.3-25.2-115-67.1-157zm-157 341.6c-33.2 0-65.7-8.9-94-25.7l-6.7-4-69.8 18.3L72 359.2l-4.4-7c-18.5-29.4-28.2-63.3-28.2-98.2 0-101.7 82.8-184.5 184.6-184.5 49.3 0 95.6 19.2 130.4 54.1 34.8 34.9 56.2 81.2 56.1 130.5 0 101.8-84.9 184.6-186.6 184.6zm101.2-138.2c-5.5-2.8-32.8-16.2-37.9-18-5.1-1.9-8.8-2.8-12.5 2.8-3.7 5.6-14.3 18-17.6 21.8-3.2 3.7-6.5 4.2-12 1.4-32.6-16.3-54-29.1-75.5-66-5.7-9.8 5.7-9.1 16.3-30.3 1.8-3.7.9-6.9-.5-9.7-1.4-2.8-12.5-30.1-17.1-41.2-4.5-10.8-9.1-9.3-12.5-9.5-3.2-.2-6.9-.2-10.6-.2-3.7 0-9.7 1.4-14.8 6.9-5.1 5.6-19.4 19-19.4 46.3 0 27.3 19.9 53.7 22.6 57.4 2.8 3.7 39.1 59.7 94.8 83.8 35.2 15.2 49 16.5 66.6 13.9 10.7-1.6 32.8-13.4 37.4-26.4 4.6-13 4.6-24.1 3.2-26.4-1.3-2.5-5-3.9-10.5-6.6z"/></svg>
84
86
  <label>Send to Referral</label>
@@ -90,7 +92,7 @@
90
92
  </div>
91
93
 
92
94
  <div v-else-if="action.type === 'redirect'">
93
- <div v-if="action._edit" class="flex flex-row items-start gap-2 p-3 bg-base-500 rounded-lg">
95
+ <div v-if="action._edit" class="flex flex-row items-start gap-2 p-3">
94
96
  <div class="flex-1 flex flex-col gap-2">
95
97
  <div>
96
98
  <label class="text-text-400 leading-1">Redirect to</label>
@@ -155,7 +157,7 @@
155
157
  </div>
156
158
  </div>
157
159
 
158
- <div class="flex flex-col gap-2">
160
+ <div class="flex flex-col gap-1">
159
161
  <label class="text-text-400">Completed</label>
160
162
  <Textbox v-model="item.props.completedTitle" />
161
163
  <Textarea v-model="item.props.completedDesc" rows="4" />
@@ -163,13 +165,14 @@
163
165
  </div>
164
166
  </div>
165
167
 
166
- <ComponentSetting2 :item="item"
167
- :view-type="viewType"
168
- :view-types="viewTypes"
169
- defaultDisplay="flex"
170
- @change="$emit('change')" />
168
+ <ComponentSetting2 :item="item"
169
+ :view-type="viewType"
170
+ :view-types="viewTypes"
171
+ :view-index="viewIndex"
172
+ defaultDisplay="block"
173
+ @change="$emit('change')" />
171
174
 
172
- <ContextMenu ref="fieldOpt" position="bottom-right" class="border-text-200">
175
+ <ContextMenu ref="fieldOpt" position="bottom-right" class="border-border-200">
173
176
  <div class="flex flex-col min-w-[120px] divide-y divide-text-100">
174
177
  <button v-for="field in fields"
175
178
  class="p-3 bg-base-500 text-left pl-8 hover:bg-text-50 disabled:bg-base-500 disabled:text-text-300"
@@ -183,11 +186,11 @@
183
186
  <ContextMenu ref="actionOpt" position="bottom-right">
184
187
  <div class="flex flex-col gap-1 p-1 min-w-[120px]">
185
188
  <button class="p-3 bg-base-500 text-left pl-8 hover:bg-text-50"
186
- @click="item.props.onSubmit.push({ type:'send-whatsapp', _edit:true })">Send Whatsapp</button>
189
+ @click="onSubmit.push({ type:'send-whatsapp', _edit:true })">Send Whatsapp</button>
187
190
  <button class="p-3 bg-base-500 text-left pl-8 hover:bg-text-50" v-if="item.props.fields.includes('referralCode')"
188
- @click="item.props.onSubmit.push({ type:'send-whatsapp-referral' });$emit('change')">Send Whatsapp to Referral</button>
191
+ @click="onSubmit.push({ type:'send-whatsapp-referral' });$emit('change')">Send Whatsapp to Referral</button>
189
192
  <button class="p-3 bg-base-500 text-left pl-8 hover:bg-text-50"
190
- @click="item.props.onSubmit.push({ type:'redirect', delay:'0', _edit:true })">Redirect</button>
193
+ @click="onSubmit.push({ type:'redirect', delay:'0', _edit:true })">Redirect</button>
191
194
  </div>
192
195
  </ContextMenu>
193
196
 
@@ -212,7 +215,7 @@
212
215
  <template #default="{ context }">
213
216
  <div class="flex-1 p-5">
214
217
  <ListItem :items="context.items"
215
- body-class="flex flex-col gap-2"
218
+ container-class="flex flex-col gap-2"
216
219
  @reorder="(from, to) => { context.items.splice(to, 0, context.items.splice(from, 1)[0]); }">
217
220
  <template v-slot="{ item, index }">
218
221
  <div class="flex flex-row items-center gap-2">
@@ -269,7 +272,7 @@
269
272
  <label class="text-text-400">Items</label>
270
273
  <ListItem :items="context.items"
271
274
  @reorder="(from, to) => { context.items.splice(to, 0, context.items.splice(from, 1)[0]); }"
272
- body-class="flex flex-col divide-y divide-text-200 border-[1px] border-text-200 mt-1">
275
+ body-class="flex flex-col divide-y divide-text-200 border-[1px] border-border-200 mt-1">
273
276
  <template v-slot="{ item, index }">
274
277
  <div class="flex flex-row items-center gap-3 px-3">
275
278
  <div data-reorder>
@@ -317,19 +320,27 @@ export default{
317
320
 
318
321
  props: {
319
322
 
320
- item: {
321
- type: Object,
322
- required: true
323
- },
323
+ item: {
324
+ type: Object,
325
+ required: true
326
+ },
327
+
328
+ viewType: String,
324
329
 
325
- viewType: String,
330
+ viewIndex: Number,
326
331
 
327
- viewTypes: Array,
332
+ viewTypes: Array,
328
333
 
329
334
  },
330
335
 
331
336
  computed: {
332
337
 
338
+ onSubmit(){
339
+ if(!Array.isArray(this.item.props.onSubmit))
340
+ this.item.props.onSubmit = []
341
+ return this.item.props.onSubmit
342
+ },
343
+
333
344
  hasTopic(){
334
345
  return this.item.props.fields.some(field => field.type === 'topic')
335
346
  },
@@ -378,7 +389,7 @@ export default{
378
389
  <style module>
379
390
 
380
391
  .comp{
381
- @apply flex flex-col gap-8;
392
+ @apply flex flex-col divide-y divide-border-50;
382
393
  }
383
394
 
384
395
  </style>
@@ -26,12 +26,12 @@
26
26
  <div v-for="yLegend in showedYLegends"
27
27
  @click="toggleExcludes(yLegend)"
28
28
  class="p-0.5 px-1 rounded-full text-black cursor-default text-xs min-w-[50px] max-w-[60px] text-center text-ellipsis overflow-hidden whitespace-nowrap capitalize"
29
- :class="excluded.includes(yLegend.key) ? 'bg-text-200' : ''"
29
+ :class="excluded.includes(yLegend.key) ? 'bg-text-300' : ''"
30
30
  :style="{ backgroundColor:excluded.includes(yLegend.key) ? '' : yLegend.color }">
31
31
  {{ yLegend.key }}
32
32
  </div>
33
33
  <button v-if="yLegends.length > showedYLegends.length" @click="$refs.legendModal.open()"
34
- class="bg-text-200 hover:bg-primary-600 w-[21px] h-[21px] rounded-full flex items-center justify-center">
34
+ class="bg-text-300 hover:bg-primary-600 w-[21px] h-[21px] rounded-full flex items-center justify-center">
35
35
  <svg width="14" height="14" class="fill-white opacity-70" 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="M64 192C28.61 192 0 220.6 0 256s28.61 64 64 64s64-28.62 64-64S99.39 192 64 192zM256 192C220.6 192 192 220.6 192 256s28.61 64 64 64s64-28.62 64-64S291.4 192 256 192zM448 192c-35.39 0-64 28.62-64 64s28.61 64 64 64s64-28.62 64-64S483.4 192 448 192z"/></svg>
36
36
  </button>
37
37
  </div>
@@ -51,7 +51,7 @@
51
51
  </template>
52
52
  <div class="flex-1 p-5 pt-0">
53
53
 
54
- <div class="flex flex-col divide-y divide-text-50">
54
+ <div class="flex flex-col divide-y divide-border-50">
55
55
  <div v-for="yLegend in yLegends" class="flex flex-row items-center gap-2 py-2">
56
56
  <div class="w-[19px] h-[19px] rounded-full" :style="{ backgroundColor:yLegend.color }"></div>
57
57
  <div class="flex-1 text-ellipsis whitespace-nowrap overflow-hidden">{{ yLegend.key }}</div>
@@ -73,7 +73,7 @@
73
73
  import {Bar} from 'vue-chartjs'
74
74
  import {color} from 'chart.js/helpers'
75
75
  import {strVars} from "../../utils/helpers.mjs";
76
- import {readyStateMixin} from "../../mixin/ready-state";
76
+ import {useEmitter} from "../../utils/event-bus";
77
77
 
78
78
  export default{
79
79
 
@@ -97,6 +97,7 @@ export default{
97
97
  },
98
98
 
99
99
  chartData(){
100
+ console.warn(this.value)
100
101
  if(!this.value?.datasets)
101
102
  return { labels:[], datasets:[] }
102
103
 
@@ -224,14 +225,43 @@ export default{
224
225
  ],
225
226
 
226
227
  height: '',
227
- datasets: null
228
+ datasets: null,
229
+ readyState: 1,
230
+ value: null
228
231
  }
229
232
  },
230
233
 
231
- inject: [ 'selectPreset' ],
234
+ inject: [ 'getSrc', 'getViewedPreset', 'getQueryFilters', 'selectPreset', 'socket' ],
232
235
 
233
236
  methods: {
234
237
 
238
+ load(){
239
+ const preset = this.getViewedPreset()
240
+ const {name, datasource = [] } = preset
241
+
242
+ this.readyState = 2
243
+ this.socket.send(this.getSrc(), {
244
+ name,
245
+ views: [{
246
+ ...this.$props,
247
+ type: 'BarChart'
248
+ }],
249
+ datasource: datasource.map(_datasource => {
250
+ return {
251
+ ..._datasource,
252
+ filters: [
253
+ ...(_datasource.filters ?? []),
254
+ ...(this.getQueryFilters()[_datasource.uid] ?? [])
255
+ ]
256
+ }
257
+ })
258
+ })
259
+ .then(_ => {
260
+ this.value = _[this.uid]
261
+ })
262
+ .finally(_ => this.readyState = 1)
263
+ },
264
+
235
265
  onClick(e, segments){
236
266
 
237
267
  const clickInteractions = (this.interactions ?? []).filter(_ => _.event === 'click')
@@ -275,9 +305,17 @@ export default{
275
305
 
276
306
  mounted() {
277
307
  this.height = this.$el.clientHeight + 'px'
278
- },
279
308
 
280
- mixins: [ readyStateMixin ],
309
+ this.load()
310
+
311
+ this.emitter = useEmitter()
312
+ this.emitter.on(`${this.uid}.load`, () => {
313
+ this.load()
314
+ })
315
+ this.emitter.on(`dashboard.load`, () => {
316
+ this.load()
317
+ })
318
+ },
281
319
 
282
320
  props: {
283
321
 
@@ -308,8 +346,6 @@ export default{
308
346
 
309
347
  yAxeOnClick: Array,
310
348
 
311
- value: Object,
312
-
313
349
  interactions: Array,
314
350
 
315
351
  uid: String
@@ -323,7 +359,7 @@ export default{
323
359
  <style module>
324
360
 
325
361
  .comp{
326
- @apply border-[1px] border-text-50 bg-base-500 rounded-lg;
362
+ @apply border-[1px] border-border-50 bg-base-500 rounded-lg;
327
363
  @apply p-3 flex flex-col min-h-[200px];
328
364
  }
329
365
 
@@ -186,7 +186,7 @@
186
186
  <div class="mt-1">
187
187
  <ListItem :items="interactions"
188
188
  class="rounded-xl"
189
- container-class="flex flex-col divide-y divide-text-50"
189
+ container-class="flex flex-col divide-y divide-border-50"
190
190
  @reorder="(from, to) => { interactions.splice(to, 0, interactions.splice(from, 1)[0]); }">
191
191
  <template v-slot="{ item, index }">
192
192
  <div class="flex flex-row items-center gap-3 px-3">
@@ -0,0 +1,125 @@
1
+ <template>
2
+ <div :class="$style.comp">
3
+ <VirtualTable class="flex-1"
4
+ :columns="datasourceColumns"
5
+ @scroll-end="loadNext"
6
+ :items="items">
7
+
8
+ </VirtualTable>
9
+ </div>
10
+ </template>
11
+
12
+ <script>
13
+ import {useEmitter} from "../../utils/event-bus";
14
+ import VirtualTable from "../../components/VirtualTable.vue";
15
+
16
+ export default{
17
+ components: {VirtualTable},
18
+
19
+ data(){
20
+ return {
21
+ value: null,
22
+ readyState: 1,
23
+ items: null,
24
+ hasNext: false
25
+ }
26
+ },
27
+
28
+ inject: [ 'getSrc', 'getViewedPreset', 'getQueryFilters', 'socket' ],
29
+
30
+ methods: {
31
+
32
+ load(){
33
+ const preset = this.getViewedPreset()
34
+ const {name, datasource} = preset
35
+
36
+ this.readyState = 2
37
+ this.socket.send(this.getSrc(), {
38
+ name,
39
+ views: [{
40
+ ...this.$props,
41
+ type: 'DataTable'
42
+ }],
43
+ datasource: datasource.map(_datasource => {
44
+ return {
45
+ ..._datasource,
46
+ filters: [
47
+ ...(_datasource.filters ?? []),
48
+ ...(this.getQueryFilters()[_datasource.uid] ?? [])
49
+ ]
50
+ }
51
+ })
52
+ })
53
+ .then(_ => {
54
+ const { items, hasNext } = _[this.uid] ?? {}
55
+ this.items = items
56
+ this.hasNext = hasNext
57
+ })
58
+ .finally(_ => this.readyState = 1)
59
+ },
60
+
61
+ loadNext(){
62
+ if(!this.hasNext) return
63
+
64
+ const preset = this.getViewedPreset()
65
+ const {name, datasource} = preset
66
+ const afterItem = this.items[this.items.length - 1]
67
+
68
+ this.socket.send(this.getSrc(), {
69
+ name,
70
+ views: [{
71
+ ...this.$props,
72
+ type: 'DataTable',
73
+ afterItem
74
+ }],
75
+ datasource: datasource.map(_datasource => {
76
+ return {
77
+ ..._datasource,
78
+ filters: [
79
+ ...(_datasource.filters ?? []),
80
+ ...(this.getQueryFilters()[_datasource.uid] ?? [])
81
+ ]
82
+ }
83
+ })
84
+ })
85
+ .then(_ => {
86
+ const { items, hasNext } = _[this.uid] ?? {}
87
+ this.items.push(...items)
88
+ this.hasNext = hasNext
89
+ })
90
+ }
91
+
92
+ },
93
+
94
+ mounted() {
95
+ this.load()
96
+
97
+ this.emitter = useEmitter()
98
+ this.emitter.on(`${this.uid}.load`, () => {
99
+ this.load()
100
+ })
101
+ this.emitter.on(`dashboard.load`, () => {
102
+ this.load()
103
+ })
104
+ },
105
+
106
+ props: {
107
+
108
+ datasourceColumns: Array,
109
+ datasourceUid: String,
110
+ label: String,
111
+ uid: String,
112
+
113
+ }
114
+
115
+ }
116
+
117
+ </script>
118
+
119
+ <style module>
120
+
121
+ .comp{
122
+ @apply min-h-[50vh] flex flex-col;
123
+ }
124
+
125
+ </style>
@@ -0,0 +1,243 @@
1
+ <template>
2
+ <div :class="$style.comp">
3
+
4
+ <div class="flex justify-center border-b-[1px] border-border-50" v-if="tabItems.length > 1">
5
+ <Tabs :items="tabItems" v-model="value.tabIndex" />
6
+ </div>
7
+
8
+ <div class="flex-1 overflow-y-auto flex flex-col">
9
+ <div v-if="value.tabIndex === 1" class="flex-1 flex flex-col gap-5 p-6">
10
+
11
+ <div class="flex flex-row items-center ">
12
+ <label class="flex-1">Active</label>
13
+ <Switch v-model="value.props.enabled" :readonly="readonly" />
14
+ </div>
15
+
16
+ <div class="flex flex-col gap-1">
17
+ <label class="text-text-400">Label</label>
18
+ <Textbox v-model="value.props.label" maxlength="50" placeholder="Label" :readonly="readonly" />
19
+ </div>
20
+
21
+ <div class="flex flex-row items-center">
22
+ <label class="flex-1">Datasource</label>
23
+ <div>
24
+ <Dropdown class="min-w-[150px]"
25
+ :readonly="readonly"
26
+ v-model="value.props.datasourceUid">
27
+ <option v-for="_datasource in datasource"
28
+ :value="_datasource.uid">
29
+ {{ _datasource.name }}
30
+ </option>
31
+ </Dropdown>
32
+ </div>
33
+ </div>
34
+
35
+ </div>
36
+
37
+ <div v-else-if="value.tabIndex === 2" class="flex-1 flex flex-col gap-5 p-6">
38
+
39
+ <div>
40
+ <Textbox placeholder="Search..." v-model="search">
41
+ <template #start>
42
+ <div class="pl-3">
43
+ <svg width="14" height="14" class="fill-text-300" 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="M500.3 443.7l-119.7-119.7c27.22-40.41 40.65-90.9 33.46-144.7C401.8 87.79 326.8 13.32 235.2 1.723C99.01-15.51-15.51 99.01 1.724 235.2c11.6 91.64 86.08 166.7 177.6 178.9c53.8 7.189 104.3-6.236 144.7-33.46l119.7 119.7c15.62 15.62 40.95 15.62 56.57 0C515.9 484.7 515.9 459.3 500.3 443.7zM79.1 208c0-70.58 57.42-128 128-128s128 57.42 128 128c0 70.58-57.42 128-128 128S79.1 278.6 79.1 208z"/></svg>
44
+ </div>
45
+ </template>
46
+ </Textbox>
47
+ </div>
48
+
49
+ <VirtualGrid class="flex-1 border-[1px] border-border-50 rounded-xl"
50
+ container-class="divide-y divide-border-50"
51
+ :items="columns">
52
+ <template #item="{ item }">
53
+ <div class="flex-1 flex flex-row gap-2 items-center p-1 px-3 group">
54
+ <div>
55
+ <Checkbox v-model="item.visible"
56
+ default="true"
57
+ :disabled="readonly"
58
+ @change="$emit('change')" />
59
+ </div>
60
+ <Textbox v-model="item.label2" :placeholder="item.label" :readonly="readonly"
61
+ class="flex-1 border-none bg-transparent" :class="$style.columnTextbox"
62
+ item-class="p-1 px-0" />
63
+ <div class="hidden flex-col justify-center group-hover:flex">
64
+ <button type="button" @click="moveUp(item)">
65
+ <svg width="11" height="11" class="fill-text-300 hover:fill-primary" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 512"><!--! Font Awesome Pro 6.0.0-alpha3 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) --><path d="M9.39 265.4l127.1-128C143.6 131.1 151.8 128 160 128s16.38 3.125 22.63 9.375l127.1 128c9.156 9.156 11.9 22.91 6.943 34.88S300.9 320 287.1 320H32.01c-12.94 0-24.62-7.781-29.58-19.75S.2333 274.5 9.39 265.4z"/></svg>
66
+ </button>
67
+ <button type="button" @click="moveDown(item)">
68
+ <svg width="11" height="11" class="fill-text-300 hover:fill-primary" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 512"><!--! Font Awesome Pro 6.0.0-alpha3 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) --><path d="M310.6 246.6l-127.1 128C176.4 380.9 168.2 384 160 384s-16.38-3.125-22.63-9.375l-127.1-128C.2244 237.5-2.516 223.7 2.438 211.8S19.07 192 32 192h255.1c12.94 0 24.62 7.781 29.58 19.75S319.8 237.5 310.6 246.6z"/></svg>
69
+ </button>
70
+ </div>
71
+ </div>
72
+ </template>
73
+ </VirtualGrid>
74
+
75
+ </div>
76
+
77
+ <div v-else-if="value.tabIndex === 3" class="flex-1 flex flex-col gap-5 p-6">
78
+
79
+ </div>
80
+
81
+ </div>
82
+
83
+ </div>
84
+ </template>
85
+
86
+ <script>
87
+
88
+ import WebPagePropertySelector from "../WebPageBuilder4/WebPagePropertySelector.vue";
89
+ import {defineAsyncComponent} from "vue";
90
+ import InteractionEdit from "./InteractionEdit.vue";
91
+
92
+ export default{
93
+ components: {
94
+ InteractionEdit,
95
+ HeightSetting: defineAsyncComponent(() => import('../WebPageBuilder4/HeightSetting.vue')),
96
+ WebPagePropertySelector
97
+ },
98
+
99
+ computed: {
100
+
101
+ interactions(){
102
+ if(!Array.isArray(this.value.props.interactions))
103
+ this.value.props.interactions = []
104
+ return this.value.props.interactions
105
+ },
106
+
107
+ selectedDatasource(){
108
+ return this.datasource.find(d => d.uid === this.value.props.datasourceUid)
109
+ },
110
+
111
+ definedProperties(){
112
+ const settings = []
113
+
114
+ for(let key in this.properties){
115
+ if(key in this.value.props){
116
+ settings.push(this.properties[key])
117
+ }
118
+ }
119
+
120
+ return settings
121
+ },
122
+
123
+ tabItems(){
124
+ return [
125
+ { text:'General', value:1 },
126
+ this.value.props.datasourceUid ? { text:'Columns', value:2 } : null,
127
+ this.value.props.datasourceUid ? { text:'Filters', value:3 } : null,
128
+ this.value.props.datasourceUid ? { text:'Sorts', value:4 } : null,
129
+ this.value.props.datasourceUid ? { text:'Pivot', value:5 } : null,
130
+ ]
131
+ .filter(_ => _)
132
+ },
133
+
134
+ columns(){
135
+ const searches = this.search.toLowerCase().split(' ').filter(_ => _.length > 2)
136
+ return (this.value.props.datasourceColumns ?? []).filter(_ => {
137
+ return !_.key.startsWith('_') &&
138
+ (searches.length < 1 || searches.every(search => _.label.toLowerCase().includes(search)))
139
+ })
140
+ },
141
+
142
+ },
143
+
144
+ data(){
145
+ return {
146
+ properties: {
147
+ 'height': { component:"HeightSetting", text:'Height', group:'Layout' }
148
+ },
149
+ search: ''
150
+ }
151
+ },
152
+
153
+ emits: [ 'change' ],
154
+
155
+ inject: [ 'uploadImage', 'viewTypes' ],
156
+
157
+ props: {
158
+
159
+ datasource: Object,
160
+
161
+ index: Number,
162
+
163
+ readonly: [ Boolean, Number ],
164
+
165
+ value: {
166
+ type: Object,
167
+ required: true
168
+ },
169
+
170
+ viewType: String,
171
+
172
+ },
173
+
174
+ methods: {
175
+
176
+ addInteraction(obj){
177
+ this.$util.push(this.interactions, obj)
178
+ },
179
+
180
+ applyDefault(){
181
+ if(!this.value.props.datasourceUid && this.datasource?.length === 1){
182
+ this.value.props.datasourceUid = this.datasource[0].uid
183
+ }
184
+
185
+ if(!this.value.tabIndex)
186
+ this.value.tabIndex = 1
187
+ },
188
+
189
+ generateColumns(){
190
+ this.value.props.datasourceColumns = (this.selectedDatasource.pivot?.enabled ?
191
+ this.selectedDatasource.pivot.columns :
192
+ this.selectedDatasource.columns)
193
+ .map((_, __) => ({
194
+ ..._,
195
+ visible: __ < 10
196
+ }))
197
+ },
198
+
199
+ moveDown(item){
200
+ const index = this.value.props.datasourceColumns.indexOf(item)
201
+ if(index + 1 < this.value.props.datasourceColumns.length){
202
+ this.value.props.datasourceColumns.splice(index + 1, 0, this.value.props.datasourceColumns.splice(index, 1)[0])
203
+ this.$emit('change')
204
+ }
205
+ },
206
+
207
+ moveUp(item){
208
+ const index = this.value.props.datasourceColumns.indexOf(item)
209
+ if(index - 1 >= 0){
210
+ this.value.props.datasourceColumns.splice(index - 1, 0, this.value.props.datasourceColumns.splice(index, 1)[0])
211
+ this.$emit('change')
212
+ }
213
+ },
214
+
215
+
216
+ },
217
+
218
+ mounted() {
219
+ this.applyDefault()
220
+ },
221
+
222
+ watch: {
223
+
224
+ 'value.props.datasourceUid'(to){
225
+ if(to){
226
+ this.generateColumns()
227
+ this.$emit('change')
228
+ }
229
+ }
230
+
231
+ }
232
+
233
+ }
234
+
235
+ </script>
236
+
237
+ <style module>
238
+
239
+ .comp{
240
+ @apply flex-1 flex flex-col;
241
+ }
242
+
243
+ </style>
@@ -15,7 +15,7 @@
15
15
  </div>
16
16
  </template>
17
17
  <template v-slot:foot>
18
- <div class="p-6 flex justify-center border-t-[1px] border-text-50">
18
+ <div class="p-6 flex justify-center border-t-[1px] border-border-50">
19
19
  <router-link :to="listSrc" target="_blank" class="text-primary flex flex-row items-center">
20
20
  Datasource Manager
21
21
  <svg class="inline ml-2 fill-primary" width="11" height="11" 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="M392 320c-13.25 0-24 10.75-24 24v112c0 4.406-3.594 8-8 8h-304c-4.406 0-8-3.594-8-8v-304c0-4.406 3.594-8 8-8h112C181.3 144 192 133.3 192 120S181.3 96 168 96h-112C25.13 96 0 121.1 0 152v304C0 486.9 25.13 512 56 512h304c30.88 0 56-25.12 56-56v-112C416 330.8 405.3 320 392 320zM488 0H320c-13.25 0-24 10.75-24 24S306.8 48 320 48h110.1L183 295c-9.375 9.375-9.375 24.56 0 33.94C187.7 333.7 193.8 336 200 336s12.28-2.344 16.97-7.031L464 81.94V192c0 13.25 10.75 24 24 24S512 205.3 512 192V24C512 10.75 501.3 0 488 0z"/></svg>