@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
@@ -1,8 +1,8 @@
1
1
  <template>
2
- <div v-if="cConfig && presets" :class="$style.comp">
2
+ <div v-if="cConfig" :class="$style.comp">
3
3
 
4
4
  <div :style="sidebarStyle"
5
- class="relative flex flex-col border-r-[1px] border-text-50 panel-400 overflow-hidden">
5
+ class="relative flex flex-col border-r-[1px] border-border-50 panel-400 overflow-hidden">
6
6
 
7
7
  <TransitionGroup class="flex-1 flex flex-col" name="openltr" tag="div">
8
8
 
@@ -33,7 +33,7 @@
33
33
  :readonly="selectedPreset.readonly"
34
34
  :value="selectedView"
35
35
  :view-type="config.viewType"
36
- @change="load({ [selectedView.uid]:selectedView })"/>
36
+ @change="load({ [selectedView.uid]:selectedView })" />
37
37
 
38
38
  </div>
39
39
  </div>
@@ -58,7 +58,7 @@
58
58
  </button>
59
59
  </div>
60
60
 
61
- <div class="flex justify-center border-b-[1px] border-text-50 mt-3">
61
+ <div class="flex justify-center border-b-[1px] border-border-50 mt-3">
62
62
  <Tabs v-model="selectedDatasource.tabIndex" :items="datasourceTabs"/>
63
63
  </div>
64
64
 
@@ -114,11 +114,11 @@
114
114
  </div>
115
115
 
116
116
  <div v-else-if="selectedDatasource.tabIndex === 2"
117
- class="flex-1 flex flex-col divide-y divide-text-50 py-3">
117
+ class="flex-1 flex flex-col divide-y divide-border-50 py-3">
118
118
 
119
119
  <ListItem :items="selectedDatasource.filters"
120
120
  class="bg-transparent"
121
- container-class="flex flex-col divide-y divide-text-50"
121
+ container-class="flex flex-col divide-y divide-border-50"
122
122
  @reorder="(from, to) => { selectedDatasource.filters.splice(to, 0, selectedDatasource.filters.splice(from, 1)[0]); }">
123
123
  <template v-slot="{ item:filter, index:idx }">
124
124
  <div class="p-5">
@@ -253,7 +253,7 @@
253
253
 
254
254
  <ListItem v-if="selectedDatasource.sorts?.length > 0"
255
255
  :items="selectedDatasource.sorts"
256
- container-class="flex flex-col rounded-lg border-[1px] border-text-50 bg-base-300 divide-y divide-text-50"
256
+ container-class="flex flex-col rounded-lg border-[1px] border-border-50 bg-base-300 divide-y divide-border-50"
257
257
  @reorder="(from, to) => { selectedDatasource.sorts.splice(to, 0, selectedDatasource.sorts.splice(from, 1)[0]); }">
258
258
  <template v-slot="{ item, index }">
259
259
  <div class="flex flex-row items-center gap-3 p-1">
@@ -341,7 +341,7 @@
341
341
 
342
342
  <div v-else-if="selectedPreset" class="flex-1 flex flex-col">
343
343
  <div class="p-5 flex flex-row gap-2">
344
- <button type="button" @click="delete cConfig.selectedUid">
344
+ <button type="button" @click="delete cConfig.params.selectedUid">
345
345
  <svg class="fill-text hover:fill-primary" height="16" viewBox="0 0 448 512" width="16"
346
346
  xmlns="http://www.w3.org/2000/svg">
347
347
  <!--! Font Awesome Pro 6.0.0-alpha3 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) -->
@@ -350,95 +350,28 @@
350
350
  </svg>
351
351
  </button>
352
352
  <Textbox v-model="selectedPreset.name"
353
- class="border-none bg-transparent"
353
+ class="flex-1 border-transparent bg-transparent"
354
354
  item-class="p-0 text-lg font-bold"
355
- @click="log(selectedPreset)"/>
355
+ :readonly="!!!presetNameChanging">
356
+ <template #end>
357
+ <div v-if="!presetNameChanging" class="pl-5">
358
+ <button type="button" class="text-primary" @click="presetNameChanging = selectedPreset.name">Edit</button>
359
+ </div>
360
+ <div v-else class="flex flex-row gap-3">
361
+ <button type="button" class="text-primary" @click="selectedPreset.name = presetNameChanging; presetNameChanging = null">Revert</button>
362
+ <button type="button" class="text-primary" @click="presetNameChanging = null">Save</button>
363
+ </div>
364
+ </template>
365
+ </Textbox>
356
366
  </div>
357
367
 
358
- <div class="flex-1 overflow-y-auto">
359
- <div class="p-5">
360
- <div class="flex flex-row gap-2">
361
- <label class="flex-1" @click="log(selectedPreset.datasource)">Datasource</label>
362
- <button v-if="!selectedPreset.readonly" class="text-primary"
363
- type="button"
364
- @click="$refs.chooseDatasource.open()">
365
- Add Datasource
366
- </button>
367
- </div>
368
- <div class="flex flex-col mt-2">
369
- <ListItem :items="selectedPreset.datasource"
370
- class="bg-transparent"
371
- container-class="flex flex-col gap-1">
372
- <template v-slot="{ item, index }">
373
- <div class="flex flex-row items-center gap-3 p-3 bg-base-500 hover:bg-text-50 rounded-lg">
374
- <div class="flex-1 text-ellipsis whitespace-nowrap overflow-hidden cursor-pointer"
375
- @click="cConfig.selectedDatasource = item.uid">
376
- {{ item.name }}
377
- </div>
378
- <button v-if="!selectedPreset.readonly" :ref="`datasourceOpt${index}`" type="button"
379
- @click="$refs.datasourceMenu.open($refs[`datasourceOpt${index}`], { index, uid:item.uid })">
380
- <svg class="fill-text-300 hover:fill-primary" height="14" viewBox="0 0 512 512"
381
- width="14" xmlns="http://www.w3.org/2000/svg">
382
- <!--! Font Awesome Pro 6.0.0-alpha3 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) -->
383
- <path
384
- 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"/>
385
- </svg>
386
- </button>
387
- </div>
388
- </template>
389
- </ListItem>
390
- </div>
391
- <ContextMenu ref="datasourceMenu" position="bottom-right">
392
- <template #default="{ context }">
393
- <div class="flex flex-col min-w-[200px]">
394
-
395
- <button :class="appStyle.menuItem" class="w-full p-3 text-left flex flex-row items-center"
396
- @click="cConfig.selectedDatasource = context.uid">
397
- <div class="w-[30px]">
398
- <svg class="fill-text-300" height="16" viewBox="0 0 512 512" width="16"
399
- xmlns="http://www.w3.org/2000/svg">
400
- <!--! Font Awesome Pro 6.0.0-alpha3 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) -->
401
- <path
402
- d="M495.6 49.23l-32.82-32.82C451.8 5.471 437.5 0 423.1 0c-14.33 0-28.66 5.469-39.6 16.41L167.5 232.5C159.1 240 154.8 249.5 152.4 259.8L128.3 367.2C126.5 376.1 133.4 384 141.1 384c.916 0 1.852-.0918 2.797-.2813c0 0 74.03-15.71 107.4-23.56c10.1-2.377 19.13-7.459 26.46-14.79l217-217C517.5 106.5 517.4 71.1 495.6 49.23zM461.7 94.4L244.7 311.4C243.6 312.5 242.5 313.1 241.2 313.4c-13.7 3.227-34.65 7.857-54.3 12.14l12.41-55.2C199.6 268.9 200.3 267.5 201.4 266.5l216.1-216.1C419.4 48.41 421.6 48 423.1 48s3.715 .4062 5.65 2.342l32.82 32.83C464.8 86.34 464.8 91.27 461.7 94.4zM424 288c-13.25 0-24 10.75-24 24v128c0 13.23-10.78 24-24 24h-304c-13.22 0-24-10.77-24-24v-304c0-13.23 10.78-24 24-24h144c13.25 0 24-10.75 24-24S229.3 64 216 64L71.1 63.99C32.31 63.99 0 96.29 0 135.1v304C0 479.7 32.31 512 71.1 512h303.1c39.69 0 71.1-32.3 71.1-72L448 312C448 298.8 437.3 288 424 288z"/>
403
- </svg>
404
- </div>
405
- Edit
406
- </button>
407
-
408
- <button v-if="!selectedPreset.readonly" :class="appStyle.menuItem"
409
- class="w-full p-3 text-left flex flex-row items-center"
410
- @click="duplicateDatasource(context.index)">
411
- <div class="w-[30px]">
412
- <svg class="fill-text-300" height="16" viewBox="0 0 512 512" width="16"
413
- xmlns="http://www.w3.org/2000/svg">
414
- <!--! Font Awesome Pro 6.0.0-alpha3 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) -->
415
- <path
416
- d="M502.6 70.63l-61.25-61.25C435.4 3.371 427.2 0 418.7 0H255.1c-35.35 0-64 28.66-64 64l.0195 256C192 355.4 220.7 384 256 384h192c35.2 0 64-28.8 64-64V93.25C512 84.77 508.6 76.63 502.6 70.63zM464 320c0 8.836-7.164 16-16 16H255.1c-8.838 0-16-7.164-16-16L239.1 64.13c0-8.836 7.164-16 16-16h128L384 96c0 17.67 14.33 32 32 32h47.1V320zM272 448c0 8.836-7.164 16-16 16H63.1c-8.838 0-16-7.164-16-16L47.98 192.1c0-8.836 7.164-16 16-16H160V128H63.99c-35.35 0-64 28.65-64 64l.0098 256C.002 483.3 28.66 512 64 512h192c35.2 0 64-28.8 64-64v-32h-47.1L272 448z"/>
417
- </svg>
418
- </div>
419
- Duplicate
420
- </button>
421
-
422
- <button v-if="!selectedPreset.readonly" :class="appStyle.menuItem"
423
- class="w-full p-3 text-left flex flex-row items-center"
424
- @click="removeDatasource(context.index)">
425
- <div class="w-[30px]">
426
- <svg class="fill-text-300" height="16" viewBox="0 0 320 512" width="16"
427
- xmlns="http://www.w3.org/2000/svg">
428
- <!--! Font Awesome Pro 6.0.0-alpha3 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) -->
429
- <path
430
- d="M310.6 361.4c12.5 12.5 12.5 32.75 0 45.25C304.4 412.9 296.2 416 288 416s-16.38-3.125-22.62-9.375L160 301.3L54.63 406.6C48.38 412.9 40.19 416 32 416S15.63 412.9 9.375 406.6c-12.5-12.5-12.5-32.75 0-45.25l105.4-105.4L9.375 150.6c-12.5-12.5-12.5-32.75 0-45.25s32.75-12.5 45.25 0L160 210.8l105.4-105.4c12.5-12.5 32.75-12.5 45.25 0s12.5 32.75 0 45.25l-105.4 105.4L310.6 361.4z"/>
431
- </svg>
432
- </div>
433
- Remove
434
- </button>
368
+ <div class="flex justify-center border-b-[1px] border-border-50">
369
+ <Tabs :items="presetTabs" v-model="selectedPresetParams.tabIndex" />
370
+ </div>
435
371
 
436
- </div>
437
- </template>
438
- </ContextMenu>
439
- </div>
372
+ <div class="flex-1 overflow-y-auto">
440
373
 
441
- <div class="p-5">
374
+ <div v-if="selectedPresetParams.tabIndex === 1" class="p-5">
442
375
  <div class="flex flex-row gap-2">
443
376
  <label class="flex-1" @click="log(selectedPreset.views)">Views</label>
444
377
  <button v-if="!selectedPreset.readonly" class="text-primary" type="button"
@@ -453,8 +386,7 @@
453
386
  :readonly="selectedPreset.readonly"
454
387
  class="mt-2">
455
388
  <template #item="{ item, parent, depth }">
456
- <div
457
- class="flex-1 p-3 overflow-hidden text-ellipsis cursor-pointer flex flex-row items-center gap-3">
389
+ <div class="flex-1 p-3 overflow-hidden text-ellipsis cursor-pointer flex flex-row items-center gap-3">
458
390
  <div>
459
391
  <svg v-if="item.type === 'Grid'" class="fill-text-200" height="14" viewBox="0 0 512 512"
460
392
  width="14" xmlns="http://www.w3.org/2000/svg">
@@ -566,9 +498,91 @@
566
498
  </div>
567
499
  </div>
568
500
 
569
- <div v-if="sharingSrc && !selectedPreset.readonly" class="p-5">
501
+ <div v-else-if="selectedPresetParams.tabIndex === 2" class="p-5">
502
+ <div class="flex flex-row gap-2">
503
+ <label class="flex-1" @click="log(selectedPreset.datasource)">Datasource</label>
504
+ <button v-if="!selectedPreset.readonly && selectedPreset.addDatasource !== false" class="text-primary"
505
+ type="button"
506
+ @click="$refs.chooseDatasource.open()">
507
+ Add Datasource
508
+ </button>
509
+ </div>
510
+ <div class="flex flex-col mt-2">
511
+ <ListItem :items="selectedPreset.datasource"
512
+ class="bg-transparent"
513
+ container-class="flex flex-col gap-1">
514
+ <template v-slot="{ item, index }">
515
+ <div class="flex flex-row items-center gap-3 p-3 bg-base-500 hover:bg-text-50 rounded-lg">
516
+ <div class="flex-1 text-ellipsis whitespace-nowrap overflow-hidden cursor-pointer"
517
+ @click="cConfig.selectedDatasource = item.uid">
518
+ {{ item.name }}
519
+ </div>
520
+ <button v-if="!selectedPreset.readonly" :ref="`datasourceOpt${index}`" type="button"
521
+ @click="$refs.datasourceMenu.open($refs[`datasourceOpt${index}`], { index, uid:item.uid })">
522
+ <svg class="fill-text-300 hover:fill-primary" height="14" viewBox="0 0 512 512"
523
+ width="14" xmlns="http://www.w3.org/2000/svg">
524
+ <!--! Font Awesome Pro 6.0.0-alpha3 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) -->
525
+ <path
526
+ 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"/>
527
+ </svg>
528
+ </button>
529
+ </div>
530
+ </template>
531
+ </ListItem>
532
+ </div>
533
+ <ContextMenu ref="datasourceMenu" position="bottom-right">
534
+ <template #default="{ context }">
535
+ <div class="flex flex-col min-w-[200px]">
536
+
537
+ <button :class="appStyle.menuItem" class="w-full p-3 text-left flex flex-row items-center"
538
+ @click="cConfig.selectedDatasource = context.uid">
539
+ <div class="w-[30px]">
540
+ <svg class="fill-text-300" height="16" viewBox="0 0 512 512" width="16"
541
+ xmlns="http://www.w3.org/2000/svg">
542
+ <!--! Font Awesome Pro 6.0.0-alpha3 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) -->
543
+ <path
544
+ d="M495.6 49.23l-32.82-32.82C451.8 5.471 437.5 0 423.1 0c-14.33 0-28.66 5.469-39.6 16.41L167.5 232.5C159.1 240 154.8 249.5 152.4 259.8L128.3 367.2C126.5 376.1 133.4 384 141.1 384c.916 0 1.852-.0918 2.797-.2813c0 0 74.03-15.71 107.4-23.56c10.1-2.377 19.13-7.459 26.46-14.79l217-217C517.5 106.5 517.4 71.1 495.6 49.23zM461.7 94.4L244.7 311.4C243.6 312.5 242.5 313.1 241.2 313.4c-13.7 3.227-34.65 7.857-54.3 12.14l12.41-55.2C199.6 268.9 200.3 267.5 201.4 266.5l216.1-216.1C419.4 48.41 421.6 48 423.1 48s3.715 .4062 5.65 2.342l32.82 32.83C464.8 86.34 464.8 91.27 461.7 94.4zM424 288c-13.25 0-24 10.75-24 24v128c0 13.23-10.78 24-24 24h-304c-13.22 0-24-10.77-24-24v-304c0-13.23 10.78-24 24-24h144c13.25 0 24-10.75 24-24S229.3 64 216 64L71.1 63.99C32.31 63.99 0 96.29 0 135.1v304C0 479.7 32.31 512 71.1 512h303.1c39.69 0 71.1-32.3 71.1-72L448 312C448 298.8 437.3 288 424 288z"/>
545
+ </svg>
546
+ </div>
547
+ Edit
548
+ </button>
549
+
550
+ <button v-if="!selectedPreset.readonly" :class="appStyle.menuItem"
551
+ class="w-full p-3 text-left flex flex-row items-center"
552
+ @click="duplicateDatasource(context.index)">
553
+ <div class="w-[30px]">
554
+ <svg class="fill-text-300" height="16" viewBox="0 0 512 512" width="16"
555
+ xmlns="http://www.w3.org/2000/svg">
556
+ <!--! Font Awesome Pro 6.0.0-alpha3 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) -->
557
+ <path
558
+ d="M502.6 70.63l-61.25-61.25C435.4 3.371 427.2 0 418.7 0H255.1c-35.35 0-64 28.66-64 64l.0195 256C192 355.4 220.7 384 256 384h192c35.2 0 64-28.8 64-64V93.25C512 84.77 508.6 76.63 502.6 70.63zM464 320c0 8.836-7.164 16-16 16H255.1c-8.838 0-16-7.164-16-16L239.1 64.13c0-8.836 7.164-16 16-16h128L384 96c0 17.67 14.33 32 32 32h47.1V320zM272 448c0 8.836-7.164 16-16 16H63.1c-8.838 0-16-7.164-16-16L47.98 192.1c0-8.836 7.164-16 16-16H160V128H63.99c-35.35 0-64 28.65-64 64l.0098 256C.002 483.3 28.66 512 64 512h192c35.2 0 64-28.8 64-64v-32h-47.1L272 448z"/>
559
+ </svg>
560
+ </div>
561
+ Duplicate
562
+ </button>
563
+
564
+ <button v-if="!selectedPreset.readonly" :class="appStyle.menuItem"
565
+ class="w-full p-3 text-left flex flex-row items-center"
566
+ @click="removeDatasource(context.index)">
567
+ <div class="w-[30px]">
568
+ <svg class="fill-text-300" height="16" viewBox="0 0 320 512" width="16"
569
+ xmlns="http://www.w3.org/2000/svg">
570
+ <!--! Font Awesome Pro 6.0.0-alpha3 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) -->
571
+ <path
572
+ d="M310.6 361.4c12.5 12.5 12.5 32.75 0 45.25C304.4 412.9 296.2 416 288 416s-16.38-3.125-22.62-9.375L160 301.3L54.63 406.6C48.38 412.9 40.19 416 32 416S15.63 412.9 9.375 406.6c-12.5-12.5-12.5-32.75 0-45.25l105.4-105.4L9.375 150.6c-12.5-12.5-12.5-32.75 0-45.25s32.75-12.5 45.25 0L160 210.8l105.4-105.4c12.5-12.5 32.75-12.5 45.25 0s12.5 32.75 0 45.25l-105.4 105.4L310.6 361.4z"/>
573
+ </svg>
574
+ </div>
575
+ Remove
576
+ </button>
577
+
578
+ </div>
579
+ </template>
580
+ </ContextMenu>
581
+ </div>
582
+
583
+ <div v-else-if="selectedPresetParams.tabIndex === 3" class="p-5">
570
584
  <div class="flex flex-row gap-2">
571
- <label class="flex-1" @click="log(selectedPreset.shared)">Sharing</label>
585
+ <label class="flex-1">Sharing</label>
572
586
  <button class="text-primary" type="button"
573
587
  @click="$refs.sharingModal.open([], { callback:addSharing })">
574
588
  Share
@@ -577,7 +591,7 @@
577
591
  <SharingModal ref="sharingModal" :src="sharingSrc"/>
578
592
  </div>
579
593
  <div class="flex flex-col gap-1 mt-2">
580
- <div v-for="(user, index) in selectedPreset.sharing"
594
+ <div v-for="(item, index) in selectedPreset.shared"
581
595
  class="bg-base-500 hover:bg-text-50 p-3 rounded-lg flex flex-row gap-2 items-center gap-1">
582
596
  <div class="flex-1 flex flex-row items-center cursor-default gap-2">
583
597
  <svg class="fill-text-200" height="14" viewBox="0 0 448 512" width="14"
@@ -586,9 +600,9 @@
586
600
  <path
587
601
  d="M224 256c70.7 0 128-57.31 128-128s-57.3-128-128-128C153.3 0 96 57.31 96 128S153.3 256 224 256zM274.7 304H173.3C77.61 304 0 381.6 0 477.3c0 19.14 15.52 34.67 34.66 34.67h378.7C432.5 512 448 496.5 448 477.3C448 381.6 370.4 304 274.7 304z"/>
588
602
  </svg>
589
- {{ user.name }}
603
+ {{ item.user?.name ?? item.userId }}
590
604
  </div>
591
- <button type="button" @click="removeSharing(index)">
605
+ <button type="button" @click="removeSharing(item, index)">
592
606
  <svg class="fill-text-300 hover:fill-red-600" height="14" viewBox="0 0 320 512"
593
607
  width="14" xmlns="http://www.w3.org/2000/svg">
594
608
  <!--! Font Awesome Pro 6.0.0-alpha3 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) -->
@@ -599,14 +613,15 @@
599
613
  </div>
600
614
  </div>
601
615
  </div>
616
+
602
617
  </div>
603
618
 
604
619
  </div>
605
620
 
606
621
  <div v-else class="flex-1 flex flex-col">
607
- <div class="p-5 flex flex-row items-start gap-2">
622
+ <div class="p-5 px-6 flex flex-row items-start gap-2">
608
623
  <div class="flex-1">
609
- <h5 @click="log(cConfig)">{{ title }}</h5>
624
+ <h5>{{ title }}</h5>
610
625
  </div>
611
626
  <button v-if="hasPresets" type="button" @click="addPreset">
612
627
  <svg class="fill-primary" height="19" viewBox="0 0 448 512" width="19" xmlns="http://www.w3.org/2000/svg">
@@ -617,25 +632,23 @@
617
632
  </button>
618
633
  </div>
619
634
 
620
- <div v-if="hasPresets" class="flex-1 overflow-y-auto px-6 flex flex-col gap-5">
635
+ <div v-if="hasPresets" class="flex-1 overflow-y-auto flex flex-col gap-5 px-3 my-5">
621
636
 
622
637
  <div v-if="(presets ?? []).length > 0">
623
- <div class="mb-2">
638
+ <div class="p-3">
624
639
  <label class="text-text-400">Views</label>
625
640
  </div>
626
641
 
627
- <ListItem :items="presets"
628
- class="bg-transparent rounded-xl overflow-hidden"
629
- container-class="divide-y divide-text-50">
642
+ <ListItem :items="presets">
630
643
  <template v-slot="{ item, index }">
631
- <div class="flex flex-row items-center gap-1 bg-base-500 hover:bg-text-50 pl-3">
632
- <Radio :checked="item.uid === cConfig.viewedUid" class="flex-1 py-3"
644
+ <div :class="$style.listMenu">
645
+ <Radio :checked="item.uid === cConfigParams.viewedUid" class="flex-1 py-3"
633
646
  @click="(e) => e.shiftKey ? openPreset(item.uid) : selectPreset(item.uid)">
634
647
  {{ item.name }}
635
648
  </Radio>
636
649
  <button :ref="`presetItemBtn${index}`"
637
- class="pr-3"
638
650
  type="button"
651
+ :class="$style.listBtn"
639
652
  @click="$refs.presetItemMenu.open($refs[`presetItemBtn${index}`], { item, index })">
640
653
  <svg class="fill-text-300 hover:fill-primary" height="14" viewBox="0 0 128 512"
641
654
  width="14" xmlns="http://www.w3.org/2000/svg">
@@ -647,43 +660,54 @@
647
660
  </div>
648
661
  </template>
649
662
  </ListItem>
650
- </div>
651
663
 
652
- <div v-if="(sharedPresets ?? []).length > 0">
653
- <div class="mb-2">
654
- <label class="text-text-400">Shared</label>
655
- </div>
664
+ <ContextMenu ref="presetItemMenu" position="bottom-right">
665
+ <template #default="{ context }">
666
+ <div v-if="!context?.sharing" class="flex flex-col min-w-[200px] divide-y divide-border-50">
656
667
 
657
- <ListItem :items="sharedPresets"
658
- class="bg-transparent rounded-xl overflow-hidden"
659
- container-class="divide-y divide-text-50">
660
- <template v-slot="{ item, index }">
661
- <div class="flex flex-row items-center gap-1 bg-base-500 hover:bg-text-50 pl-3">
662
- <Radio :checked="item.uid === cConfig.viewedUid" class="flex-1 py-3"
663
- @click="(e) => e.shiftKey ? openPreset(item.uid) : selectPreset(item.uid)">
664
- {{ item.name }}
665
- </Radio>
666
- <button :ref="`sharedPresetItemBtn${index}`"
667
- class="pr-3"
668
- type="button"
669
- @click="$refs.presetItemMenu.open($refs[`sharedPresetItemBtn${index}`], { item, index, sharing:true })">
670
- <svg class="fill-text-300 hover:fill-primary" height="14" viewBox="0 0 128 512"
671
- width="14" xmlns="http://www.w3.org/2000/svg">
672
- <!--! Font Awesome Pro 6.0.0-alpha3 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) -->
673
- <path
674
- d="M128 64c0-35.39-28.62-64-64-64S0 28.61 0 64s28.62 64 64 64S128 99.39 128 64zM128 256c0-35.39-28.62-64-64-64S0 220.6 0 256s28.62 64 64 64S128 291.4 128 256zM128 448c0-35.39-28.62-64-64-64s-64 28.61-64 64s28.62 64 64 64S128 483.4 128 448z"/>
675
- </svg>
668
+ <div class="divide-y divide-border-50">
669
+ <button :class="appStyle.menuItem" class="w-full p-3 text-left flex flex-row items-center"
670
+ @click="openPreset(context.item.uid)">
671
+ <div class="w-[30px]">
672
+ <svg class="fill-text-300" height="16" viewBox="0 0 512 512" width="16"
673
+ xmlns="http://www.w3.org/2000/svg">
674
+ <!--! Font Awesome Pro 6.0.0-alpha3 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) -->
675
+ <path
676
+ d="M256 0C114.6 0 0 114.6 0 255.1S114.6 512 255.1 512S512 397.4 512 256S397.4 0 256 0zM210.8 368.1c-22.25 5.24-71.61 15.71-71.61 15.71c-.6309 .127-1.22 .1499-1.83 .1499c-5.711 0-10.33-5.232-9.151-11.13l16.1-71.61c1.551-6.895 5.027-13.21 10.03-18.21l101-101l74.67 74.67l-101.6 101.6C223.5 363.1 217.5 366.5 210.8 368.1zM373.1 213.6l-20.45 20.45l-74.67-74.67l20.4-20.4C305.7 131.6 315.2 128 324.8 128c9.553 0 19.11 3.646 26.4 10.94l21.88 21.88C387.6 175.4 387.7 198.1 373.1 213.6z"/>
677
+ </svg>
678
+ </div>
679
+ Edit
680
+ </button>
681
+
682
+ <button :class="appStyle.menuItem" class="w-full p-3 text-left flex flex-row items-center"
683
+ @click="duplicate(context.item)">
684
+ <div class="w-[30px]">
685
+ <svg class="fill-text-300" height="16" viewBox="0 0 512 512" width="16"
686
+ xmlns="http://www.w3.org/2000/svg">
687
+ <!--! Font Awesome Pro 6.0.0-alpha3 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) -->
688
+ <path
689
+ d="M502.6 70.63l-61.25-61.25C435.4 3.371 427.2 0 418.7 0H255.1c-35.35 0-64 28.66-64 64l.0195 256C192 355.4 220.7 384 256 384h192c35.2 0 64-28.8 64-64V93.25C512 84.77 508.6 76.63 502.6 70.63zM464 320c0 8.836-7.164 16-16 16H255.1c-8.838 0-16-7.164-16-16L239.1 64.13c0-8.836 7.164-16 16-16h128L384 96c0 17.67 14.33 32 32 32h47.1V320zM272 448c0 8.836-7.164 16-16 16H63.1c-8.838 0-16-7.164-16-16L47.98 192.1c0-8.836 7.164-16 16-16H160V128H63.99c-35.35 0-64 28.65-64 64l.0098 256C.002 483.3 28.66 512 64 512h192c35.2 0 64-28.8 64-64v-32h-47.1L272 448z"/>
690
+ </svg>
691
+ </div>
692
+ Duplicate
693
+ </button>
694
+ </div>
695
+
696
+ <button :class="appStyle.menuItem" class="w-full p-3 text-left flex flex-row items-center"
697
+ @click="confirm('Remove this preset?', () => removePreset(context.item))">
698
+ <div class="w-[30px]">
699
+ <svg class="fill-text-300" height="16" viewBox="0 0 320 512" width="16"
700
+ xmlns="http://www.w3.org/2000/svg">
701
+ <!--! Font Awesome Pro 6.0.0-alpha3 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) -->
702
+ <path
703
+ d="M310.6 361.4c12.5 12.5 12.5 32.75 0 45.25C304.4 412.9 296.2 416 288 416s-16.38-3.125-22.62-9.375L160 301.3L54.63 406.6C48.38 412.9 40.19 416 32 416S15.63 412.9 9.375 406.6c-12.5-12.5-12.5-32.75 0-45.25l105.4-105.4L9.375 150.6c-12.5-12.5-12.5-32.75 0-45.25s32.75-12.5 45.25 0L160 210.8l105.4-105.4c12.5-12.5 32.75-12.5 45.25 0s12.5 32.75 0 45.25l-105.4 105.4L310.6 361.4z"/>
704
+ </svg>
705
+ </div>
706
+ Remove
676
707
  </button>
677
708
  </div>
678
- </template>
679
- </ListItem>
680
- </div>
681
-
682
- <ContextMenu ref="presetItemMenu" position="bottom-right">
683
- <template #default="{ context }">
684
- <div v-if="!context.sharing" class="flex flex-col min-w-[200px] divide-y divide-text-50">
685
709
 
686
- <div class="divide-y divide-text-50">
710
+ <div v-else>
687
711
  <button :class="appStyle.menuItem" class="w-full p-3 text-left flex flex-row items-center"
688
712
  @click="openPreset(context.item.uid)">
689
713
  <div class="w-[30px]">
@@ -694,9 +718,8 @@
694
718
  d="M256 0C114.6 0 0 114.6 0 255.1S114.6 512 255.1 512S512 397.4 512 256S397.4 0 256 0zM210.8 368.1c-22.25 5.24-71.61 15.71-71.61 15.71c-.6309 .127-1.22 .1499-1.83 .1499c-5.711 0-10.33-5.232-9.151-11.13l16.1-71.61c1.551-6.895 5.027-13.21 10.03-18.21l101-101l74.67 74.67l-101.6 101.6C223.5 363.1 217.5 366.5 210.8 368.1zM373.1 213.6l-20.45 20.45l-74.67-74.67l20.4-20.4C305.7 131.6 315.2 128 324.8 128c9.553 0 19.11 3.646 26.4 10.94l21.88 21.88C387.6 175.4 387.7 198.1 373.1 213.6z"/>
695
719
  </svg>
696
720
  </div>
697
- Edit
721
+ Open
698
722
  </button>
699
-
700
723
  <button :class="appStyle.menuItem" class="w-full p-3 text-left flex flex-row items-center"
701
724
  @click="duplicate(context.item)">
702
725
  <div class="w-[30px]">
@@ -709,62 +732,76 @@
709
732
  </div>
710
733
  Duplicate
711
734
  </button>
735
+ <button :class="appStyle.menuItem" class="w-full p-3 text-left flex flex-row items-center"
736
+ @click="removeShared(context.item, context.index)">
737
+ <div class="w-[30px]">
738
+ <svg class="fill-text-300" height="16" viewBox="0 0 320 512" width="16"
739
+ xmlns="http://www.w3.org/2000/svg">
740
+ <!--! Font Awesome Pro 6.0.0-alpha3 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) -->
741
+ <path
742
+ d="M310.6 361.4c12.5 12.5 12.5 32.75 0 45.25C304.4 412.9 296.2 416 288 416s-16.38-3.125-22.62-9.375L160 301.3L54.63 406.6C48.38 412.9 40.19 416 32 416S15.63 412.9 9.375 406.6c-12.5-12.5-12.5-32.75 0-45.25l105.4-105.4L9.375 150.6c-12.5-12.5-12.5-32.75 0-45.25s32.75-12.5 45.25 0L160 210.8l105.4-105.4c12.5-12.5 32.75-12.5 45.25 0s12.5 32.75 0 45.25l-105.4 105.4L310.6 361.4z"/>
743
+ </svg>
744
+ </div>
745
+ Remove
746
+ </button>
712
747
  </div>
748
+ </template>
749
+ </ContextMenu>
750
+ </div>
713
751
 
714
- <button :class="appStyle.menuItem" class="w-full p-3 text-left flex flex-row items-center"
715
- @click="confirm('Remove this preset?', () => removePreset(context.item))">
716
- <div class="w-[30px]">
717
- <svg class="fill-text-300" height="16" viewBox="0 0 320 512" width="16"
718
- xmlns="http://www.w3.org/2000/svg">
719
- <!--! Font Awesome Pro 6.0.0-alpha3 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) -->
720
- <path
721
- d="M310.6 361.4c12.5 12.5 12.5 32.75 0 45.25C304.4 412.9 296.2 416 288 416s-16.38-3.125-22.62-9.375L160 301.3L54.63 406.6C48.38 412.9 40.19 416 32 416S15.63 412.9 9.375 406.6c-12.5-12.5-12.5-32.75 0-45.25l105.4-105.4L9.375 150.6c-12.5-12.5-12.5-32.75 0-45.25s32.75-12.5 45.25 0L160 210.8l105.4-105.4c12.5-12.5 32.75-12.5 45.25 0s12.5 32.75 0 45.25l-105.4 105.4L310.6 361.4z"/>
722
- </svg>
723
- </div>
724
- Remove
725
- </button>
726
- </div>
752
+ <div v-if="(sharedPresets ?? []).length > 0">
753
+ <div class="px-3">
754
+ <label class="text-text-400">Shared</label>
755
+ </div>
727
756
 
728
- <div v-else>
729
- <button :class="appStyle.menuItem" class="w-full p-3 text-left flex flex-row items-center"
730
- @click="openPreset(context.item.uid)">
731
- <div class="w-[30px]">
732
- <svg class="fill-text-300" height="16" viewBox="0 0 512 512" width="16"
733
- xmlns="http://www.w3.org/2000/svg">
734
- <!--! Font Awesome Pro 6.0.0-alpha3 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) -->
735
- <path
736
- d="M256 0C114.6 0 0 114.6 0 255.1S114.6 512 255.1 512S512 397.4 512 256S397.4 0 256 0zM210.8 368.1c-22.25 5.24-71.61 15.71-71.61 15.71c-.6309 .127-1.22 .1499-1.83 .1499c-5.711 0-10.33-5.232-9.151-11.13l16.1-71.61c1.551-6.895 5.027-13.21 10.03-18.21l101-101l74.67 74.67l-101.6 101.6C223.5 363.1 217.5 366.5 210.8 368.1zM373.1 213.6l-20.45 20.45l-74.67-74.67l20.4-20.4C305.7 131.6 315.2 128 324.8 128c9.553 0 19.11 3.646 26.4 10.94l21.88 21.88C387.6 175.4 387.7 198.1 373.1 213.6z"/>
737
- </svg>
738
- </div>
739
- Open
740
- </button>
741
- <button :class="appStyle.menuItem" class="w-full p-3 text-left flex flex-row items-center"
742
- @click="duplicate(context.item)">
743
- <div class="w-[30px]">
744
- <svg class="fill-text-300" height="16" viewBox="0 0 512 512" width="16"
745
- xmlns="http://www.w3.org/2000/svg">
746
- <!--! Font Awesome Pro 6.0.0-alpha3 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) -->
747
- <path
748
- d="M502.6 70.63l-61.25-61.25C435.4 3.371 427.2 0 418.7 0H255.1c-35.35 0-64 28.66-64 64l.0195 256C192 355.4 220.7 384 256 384h192c35.2 0 64-28.8 64-64V93.25C512 84.77 508.6 76.63 502.6 70.63zM464 320c0 8.836-7.164 16-16 16H255.1c-8.838 0-16-7.164-16-16L239.1 64.13c0-8.836 7.164-16 16-16h128L384 96c0 17.67 14.33 32 32 32h47.1V320zM272 448c0 8.836-7.164 16-16 16H63.1c-8.838 0-16-7.164-16-16L47.98 192.1c0-8.836 7.164-16 16-16H160V128H63.99c-35.35 0-64 28.65-64 64l.0098 256C.002 483.3 28.66 512 64 512h192c35.2 0 64-28.8 64-64v-32h-47.1L272 448z"/>
749
- </svg>
750
- </div>
751
- Duplicate
752
- </button>
753
- <button :class="appStyle.menuItem" class="w-full p-3 text-left flex flex-row items-center"
754
- @click="removeShared(context.item, context.index)">
755
- <div class="w-[30px]">
756
- <svg class="fill-text-300" height="16" viewBox="0 0 320 512" width="16"
757
- xmlns="http://www.w3.org/2000/svg">
757
+ <ListItem :items="sharedPresets"
758
+ class="bg-transparent">
759
+ <template v-slot="{ item, index }">
760
+ <div :class="$style.listMenu">
761
+ <Radio :checked="item.uid === cConfigParams.viewedUid" class="flex-1 py-3"
762
+ @click="(e) => e.shiftKey ? openPreset(item.uid) : selectPreset(item.uid)">
763
+ {{ item.name }}
764
+ </Radio>
765
+ <button :ref="`sharedPresetItemBtn${index}`"
766
+ type="button"
767
+ :class="$style.listBtn"
768
+ @click="$refs.contextMenu2.open($refs[`sharedPresetItemBtn${index}`], { item, index, sharing:true })">
769
+ <svg class="fill-text-300 hover:fill-primary" height="14" viewBox="0 0 128 512"
770
+ width="14" xmlns="http://www.w3.org/2000/svg">
758
771
  <!--! Font Awesome Pro 6.0.0-alpha3 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) -->
759
772
  <path
760
- d="M310.6 361.4c12.5 12.5 12.5 32.75 0 45.25C304.4 412.9 296.2 416 288 416s-16.38-3.125-22.62-9.375L160 301.3L54.63 406.6C48.38 412.9 40.19 416 32 416S15.63 412.9 9.375 406.6c-12.5-12.5-12.5-32.75 0-45.25l105.4-105.4L9.375 150.6c-12.5-12.5-12.5-32.75 0-45.25s32.75-12.5 45.25 0L160 210.8l105.4-105.4c12.5-12.5 32.75-12.5 45.25 0s12.5 32.75 0 45.25l-105.4 105.4L310.6 361.4z"/>
773
+ d="M128 64c0-35.39-28.62-64-64-64S0 28.61 0 64s28.62 64 64 64S128 99.39 128 64zM128 256c0-35.39-28.62-64-64-64S0 220.6 0 256s28.62 64 64 64S128 291.4 128 256zM128 448c0-35.39-28.62-64-64-64s-64 28.61-64 64s28.62 64 64 64S128 483.4 128 448z"/>
761
774
  </svg>
762
- </div>
763
- Remove
764
- </button>
765
- </div>
766
- </template>
767
- </ContextMenu>
775
+ </button>
776
+ </div>
777
+ </template>
778
+ </ListItem>
779
+
780
+ <ContextMenu ref="contextMenu2" position="bottom-right">
781
+ <template #default="{ context }">
782
+ <div class="flex flex-col min-w-[200px] divide-y divide-border-50">
783
+
784
+ <button class="w-full p-3 text-left flex flex-row gap-3" :class="appStyle.menuItem"
785
+ @click="duplicate(context.item)">
786
+ <div class="w-[24px]">
787
+ <svg width="16" height="16" class="mx-auto fill-text-300" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path d="M433.941 65.941l-51.882-51.882A48 48 0 0 0 348.118 0H176c-26.51 0-48 21.49-48 48v48H48c-26.51 0-48 21.49-48 48v320c0 26.51 21.49 48 48 48h224c26.51 0 48-21.49 48-48v-48h80c26.51 0 48-21.49 48-48V99.882a48 48 0 0 0-14.059-33.941zM266 464H54a6 6 0 0 1-6-6V150a6 6 0 0 1 6-6h74v224c0 26.51 21.49 48 48 48h96v42a6 6 0 0 1-6 6zm128-96H182a6 6 0 0 1-6-6V54a6 6 0 0 1 6-6h106v88c0 13.255 10.745 24 24 24h88v202a6 6 0 0 1-6 6zm6-256h-64V48h9.632c1.591 0 3.117.632 4.243 1.757l48.368 48.368a6 6 0 0 1 1.757 4.243V112z"/></svg>
788
+ </div>
789
+ Duplicate
790
+ </button>
791
+
792
+ <button class="w-full p-3 text-left flex flex-row gap-3 text-red-500" :class="appStyle.menuItem"
793
+ @click="removeShared(context.item, context.index)">
794
+ <div class="w-[24px]">
795
+ <svg width="19" height="19" class="mx-auto fill-text-300" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 512"><path d="M469.65 181.65l-11.31-11.31c-6.25-6.25-16.38-6.25-22.63 0L384 222.06l-51.72-51.72c-6.25-6.25-16.38-6.25-22.63 0l-11.31 11.31c-6.25 6.25-6.25 16.38 0 22.63L350.06 256l-51.72 51.72c-6.25 6.25-6.25 16.38 0 22.63l11.31 11.31c6.25 6.25 16.38 6.25 22.63 0L384 289.94l51.72 51.72c6.25 6.25 16.38 6.25 22.63 0l11.31-11.31c6.25-6.25 6.25-16.38 0-22.63L417.94 256l51.72-51.72c6.24-6.25 6.24-16.38-.01-22.63zM576 64H205.26C188.28 64 172 70.74 160 82.74L9.37 233.37c-12.5 12.5-12.5 32.76 0 45.25L160 429.25c12 12 28.28 18.75 45.25 18.75H576c35.35 0 64-28.65 64-64V128c0-35.35-28.65-64-64-64zm16 320c0 8.82-7.18 16-16 16H205.26c-4.27 0-8.29-1.66-11.31-4.69L54.63 256l139.31-139.31c3.02-3.02 7.04-4.69 11.31-4.69H576c8.82 0 16 7.18 16 16v256z"/></svg>
796
+ </div>
797
+ Remove
798
+ </button>
799
+
800
+ </div>
801
+ </template>
802
+ </ContextMenu>
803
+ </div>
804
+
768
805
 
769
806
  </div>
770
807
  <div v-else class="flex-1 flex items-center justify-center">
@@ -831,7 +868,7 @@
831
868
  </div>
832
869
  </div>
833
870
  <ContextMenu ref="contextMenu" class="panel-400">
834
- <div class="flex flex-col min-w-[300px] divide-y divide-text-50">
871
+ <div class="flex flex-col min-w-[300px] divide-y divide-border-50">
835
872
 
836
873
  <div class="p-3 flex flex-col gap-1 bg-base-300">
837
874
  <button v-for="(preset, idx) in presets"
@@ -945,6 +982,7 @@ export default {
945
982
  BarChartSetting: defineAsyncComponent(() => import('./Dashboard/BarChartSetting.vue')),
946
983
  MetricSetting: defineAsyncComponent(() => import('./Dashboard/MetricSetting.vue')),
947
984
  GHeatMapsSetting: defineAsyncComponent(() => import('./Dashboard/GHeatMapsSetting.vue')),
985
+ DataTableSetting: defineAsyncComponent(() => import('./Dashboard/DataTableSetting.vue')),
948
986
  VirtualTableSetting: defineAsyncComponent(() => import('./Dashboard/VirtualTableSetting.vue')),
949
987
  PieSetting: defineAsyncComponent(() => import('./Dashboard/PieSetting.vue')),
950
988
  PolarAreaSetting: defineAsyncComponent(() => import('./Dashboard/PolarAreaSetting.vue')),
@@ -956,14 +994,17 @@ export default {
956
994
  computed: {
957
995
 
958
996
  cConfig() {
959
- const config = this.config
997
+ if (!this.config.viewType)
998
+ this.config.viewType = 'md:'
960
999
 
961
- if (config) {
962
- if (!config.viewType)
963
- config.viewType = 'md:'
964
- }
1000
+ return this.config
1001
+ },
1002
+
1003
+ cConfigParams() {
1004
+ if(!this.cConfig.params)
1005
+ this.cConfig.params = {}
965
1006
 
966
- return config
1007
+ return this.cConfig.params
967
1008
  },
968
1009
 
969
1010
  componentsConfig() {
@@ -972,11 +1013,46 @@ export default {
972
1013
  return this.cConfig.components
973
1014
  },
974
1015
 
1016
+ datasourceTabs() {
1017
+ return [
1018
+ {text: "Columns", value: 1},
1019
+ {text: "Filters", value: 2},
1020
+ {text: "Sorts", value: 3},
1021
+ this.selectedDatasource?.pivot !== false ? {text: "Pivots", value: 4} : null,
1022
+ ]
1023
+ .filter(_ => _)
1024
+ },
1025
+
975
1026
  hasPresets() {
976
1027
  return (this.presets ?? []).length > 0 ||
977
1028
  (this.sharedPresets ?? []).length > 0
978
1029
  },
979
1030
 
1031
+ presets(){
1032
+ if(!Array.isArray(this.config.presets)){
1033
+ this.config.presets = []
1034
+ }
1035
+
1036
+ return this.config.presets
1037
+ },
1038
+
1039
+ presetTabs(){
1040
+ return [
1041
+ { text:"Datasource", value:2 },
1042
+ { text:"Views", value:1 },
1043
+ !!this.sharingSrc ? { text:"Share", value:3 } : null,
1044
+ ]
1045
+ .filter(_ => _)
1046
+ },
1047
+
1048
+ sharedPresets(){
1049
+ if(!Array.isArray(this.config.sharedPresets)){
1050
+ this.config.sharedPresets = []
1051
+ }
1052
+
1053
+ return this.config.sharedPresets
1054
+ },
1055
+
980
1056
  selectedDatasource() {
981
1057
  const datasource = this.selectedPreset?.datasource[this.selectedPreset.datasource.findIndex(_ => _.uid === this.cConfig.selectedDatasource)]
982
1058
 
@@ -1037,20 +1113,34 @@ export default {
1037
1113
  selectedPreset() {
1038
1114
  if(!Array.isArray(this.presets)) return
1039
1115
 
1040
- const preset = this.presets[this.presets.findIndex(_ => _.uid === this.cConfig.selectedUid)] ??
1041
- this.sharedPresets[this.sharedPresets.findIndex(_ => _.uid === this.cConfig.selectedUid)]
1116
+ const preset = this.presets[this.presets.findIndex(_ => _.uid === this.cConfig.params.selectedUid)] ??
1117
+ this.sharedPresets[this.sharedPresets.findIndex(_ => _.uid === this.cConfig.params.selectedUid)]
1118
+ if(!preset) return
1042
1119
 
1043
- if (preset) {
1044
- if (!Array.isArray(preset.datasource))
1045
- preset.datasource = []
1120
+ if (!Array.isArray(preset.datasource))
1121
+ preset.datasource = []
1046
1122
 
1047
- if (!Array.isArray(preset.views))
1048
- preset.views = []
1049
- }
1123
+ if (!Array.isArray(preset.views))
1124
+ preset.views = []
1125
+
1126
+ if(!preset.params)
1127
+ preset.params = {}
1128
+
1129
+ if(!preset.params.tabIndex)
1130
+ preset.params.tabIndex = 2
1050
1131
 
1051
1132
  return preset
1052
1133
  },
1053
1134
 
1135
+ selectedPresetParams(){
1136
+ if(!this.selectedPreset) return
1137
+
1138
+ if(!this.selectedPreset.params)
1139
+ this.selectedPreset.params = {}
1140
+
1141
+ return this.selectedPreset.params
1142
+ },
1143
+
1054
1144
  selectedView() {
1055
1145
  return findComponents(this.selectedPreset?.views, this.cConfig.selectedView)
1056
1146
  },
@@ -1074,9 +1164,9 @@ export default {
1074
1164
  viewedPreset() {
1075
1165
  if(!Array.isArray(this.presets)) return
1076
1166
 
1077
- return this.presets[this.presets.findIndex(_ => _.uid === this.cConfig.viewedUid)]
1167
+ return this.presets[this.presets.findIndex(_ => _.uid === this.cConfigParams.viewedUid)]
1078
1168
  ??
1079
- this.sharedPresets[this.sharedPresets.findIndex(_ => _.uid === this.cConfig.viewedUid)]
1169
+ this.sharedPresets[this.sharedPresets.findIndex(_ => _.uid === this.cConfigParams.viewedUid)]
1080
1170
  },
1081
1171
 
1082
1172
  viewedComponents() {
@@ -1111,7 +1201,21 @@ export default {
1111
1201
  }
1112
1202
 
1113
1203
  return filters
1114
- }
1204
+ },
1205
+
1206
+ src(){ return `${this.controller}.load` },
1207
+
1208
+ presetSrc(){ return `${this.controller}.preset` },
1209
+
1210
+ datasourceSrc(){ return `${this.controller}.load-datasource` },
1211
+
1212
+ datasourceListSrc(){ return `/datasource` },
1213
+
1214
+ previewSrc(){ return `${this.controller}.preview` },
1215
+
1216
+ sharingSrc(){ return `${this.controller}.load-sharing` },
1217
+
1218
+ removeSharingSrc(){ return `${this.controller}.remove-shared` },
1115
1219
 
1116
1220
  },
1117
1221
 
@@ -1156,12 +1260,6 @@ export default {
1156
1260
 
1157
1261
  initialConfig: null,
1158
1262
 
1159
- datasourceTabs: [
1160
- { text:"Columns", value:1 },
1161
- {text: "Filters", value: 2},
1162
- {text: "Sorts", value: 3},
1163
- {text: "Pivots", value: 4},
1164
- ],
1165
1263
  datasourceColumnSearch: '',
1166
1264
 
1167
1265
  enumCache: {},
@@ -1181,9 +1279,7 @@ export default {
1181
1279
 
1182
1280
  values: {},
1183
1281
 
1184
- config: {},
1185
- presets: [],
1186
- sharedPresets: []
1282
+ presetNameChanging: null
1187
1283
  }
1188
1284
  },
1189
1285
 
@@ -1229,16 +1325,42 @@ export default {
1229
1325
  uid,
1230
1326
  }
1231
1327
  this.presets.push(newPreset)
1232
- this.cConfig.viewedUid = uid
1328
+ this.cConfigParams.viewedUid = uid
1233
1329
 
1234
1330
  this.openPreset(newPreset.uid, {select: true})
1235
1331
  },
1236
1332
 
1237
1333
  addSharing(item) {
1238
- if (!Array.isArray(this.selectedPreset.sharing))
1239
- this.selectedPreset.sharing = []
1334
+ const obj = {
1335
+ key: this.presetKey,
1336
+ presetUid: this.selectedPreset.uid,
1337
+ userId: item.id
1338
+ }
1240
1339
 
1241
- this.$util.push(this.selectedPreset.sharing, item, {key: "id"})
1340
+ this.socket.send(`${this.controller}.add-sharing`, obj)
1341
+ .then(newItem => {
1342
+ if (!Array.isArray(this.selectedPreset.shared))
1343
+ this.selectedPreset.shared = []
1344
+ this.$util.push(this.selectedPreset.shared, newItem, {key: "presetUid"})
1345
+ })
1346
+ },
1347
+
1348
+ removeSharing(item, index) {
1349
+ this.confirm('Remove shared?', () => {
1350
+ this.socket.send(`${this.controller}.remove-sharing`, item)
1351
+ .then(_ => {
1352
+ this.selectedPreset.sharing.splice(index, 1)
1353
+ })
1354
+ })
1355
+ },
1356
+
1357
+ removeShared(item, index) {
1358
+ this.confirm('Remove shared?', () => {
1359
+ this.socket.send(`${this.controller}.remove-sharing`, item.UserConfigPresetShared)
1360
+ .then(_ => {
1361
+ this.sharedPresets.splice(index, 1)
1362
+ })
1363
+ })
1242
1364
  },
1243
1365
 
1244
1366
  addSort(obj) {
@@ -1321,19 +1443,28 @@ export default {
1321
1443
  this.presets.push(newPreset)
1322
1444
 
1323
1445
  this.$nextTick(() => {
1324
- this.cConfig.viewedUid = newPreset.uid
1446
+ this.cConfigParams.viewedUid = newPreset.uid
1325
1447
  this.openPreset(newPreset.uid)
1326
1448
  this.selectPreset(newPreset.uid)
1327
- this.saveConfig()
1449
+ this.savePreset()
1328
1450
  })
1329
1451
  },
1330
1452
 
1331
1453
  duplicateComponent(item, parent) {
1332
1454
 
1455
+ const recurseSet = (item) => {
1456
+ item.uid = getPresetUid()
1457
+
1458
+ if(Array.isArray(item.items)){
1459
+ for(let subItem of item.items)
1460
+ recurseSet(subItem)
1461
+ }
1462
+ }
1463
+
1333
1464
  const index = parent.findIndex(_ => _ === item)
1334
1465
 
1335
1466
  const newItem = JSON.parse(JSON.stringify(item))
1336
- newItem.uid = getPresetUid()
1467
+ recurseSet(newItem)
1337
1468
  newItem.name += ' (Copy)';
1338
1469
 
1339
1470
  parent.splice(index + 1, null, newItem)
@@ -1363,36 +1494,12 @@ export default {
1363
1494
  },
1364
1495
 
1365
1496
  async load(uids) {
1366
- if (this.readyState !== 1) return
1367
- if (!this.viewedComponents) return
1368
- if (!this.cConfig) return
1369
-
1370
- const views = this.recurseViews(this.viewedComponents, uids)
1371
- if (views?.length < 1) return
1372
-
1373
- const {name, datasource} = this.viewedPreset
1374
-
1375
- !uids ? this.readyState = 0 : Object.keys(uids).forEach(uid => this.emitter.emit(`${uid}.readyState`, 2))
1376
- this.socket.send(this.src, {
1377
- name,
1378
- views,
1379
- datasource: datasource.map(_datasource => {
1380
- return {
1381
- ..._datasource,
1382
- filters: [
1383
- ...(_datasource.filters ?? []),
1384
- ...(this.queryFilters[_datasource.uid] ?? [])
1385
- ]
1386
- }
1387
- })
1388
- })
1389
- .then(_ => {
1390
- Object.assign(this.values, _)
1391
- })
1392
- .catch(err => this.alert(err))
1393
- .finally(_ => {
1394
- !uids ? this.readyState = 1 : Object.keys(uids).forEach(uid => this.emitter.emit(`${uid}.readyState`, 1))
1395
- })
1497
+ if(uids){
1498
+ Object.keys(uids).forEach(uid => this.emitter.emit(`${uid}.load`))
1499
+ }
1500
+ else{
1501
+ this.emitter.emit(`dashboard.load`)
1502
+ }
1396
1503
  },
1397
1504
 
1398
1505
  async loadNext(component) {
@@ -1450,9 +1557,8 @@ export default {
1450
1557
  }
1451
1558
  },
1452
1559
 
1453
- openPreset(uid, opt = {}) {
1454
- this.cConfig.selectedUid = uid
1455
- this.saveConfig()
1560
+ openPreset(uid) {
1561
+ this.cConfig.params.selectedUid = uid
1456
1562
  },
1457
1563
 
1458
1564
  previewDatasource(datasource) {
@@ -1507,18 +1613,6 @@ export default {
1507
1613
  this.load()
1508
1614
  },
1509
1615
 
1510
- removeShared(item, index) {
1511
- if (!this.removeSharingSrc)
1512
- return this.alert('Unable to remove shared preset.')
1513
-
1514
- this.confirm('Remove this preset?', () => {
1515
- this.socket.send(this.removeSharingSrc, item)
1516
- .then(_ => {
1517
- this.sharedPresets.splice(index, 1)
1518
- })
1519
- })
1520
- },
1521
-
1522
1616
  selectPreset(uid, params = {}) {
1523
1617
  this.$router.push({
1524
1618
  query: {
@@ -1526,7 +1620,7 @@ export default {
1526
1620
  ...params
1527
1621
  }
1528
1622
  })
1529
- this.saveConfig()
1623
+ this.savePreset()
1530
1624
  },
1531
1625
 
1532
1626
  resize1(w) {
@@ -1580,48 +1674,45 @@ export default {
1580
1674
  })
1581
1675
  },
1582
1676
 
1583
- removeSharing(index) {
1584
- const user = this.selectedPreset.sharing[index]
1585
-
1586
- for (let datasource of this.selectedPreset.datasource) {
1587
- for (let filter of datasource.filters) {
1588
- const index = (filter.sharing ?? []).findIndex(_ => _.id === user.id)
1589
- if (index > -1) {
1590
- filter.sharing.splice(index, 1)
1591
- }
1677
+ async loadPreset(){
1678
+ if(!Object.keys(this.$route.query).map(_ => _.toLowerCase()).includes('reset')) {
1679
+ if(this.presetKey) {
1680
+ return this.socket.send(this.presetSrc, { key:this.presetKey })
1681
+ .then(async (config) => {
1682
+ if(config){
1683
+ Object.assign(this.config, config ?? {})
1684
+
1685
+ /*if(this.$route.query?.search)
1686
+ this.preset.search = this.$route.query.search*/
1687
+ }
1688
+ })
1689
+ .catch(() => {})
1592
1690
  }
1593
1691
  }
1594
-
1595
- this.selectedPreset.sharing.splice(index, 1)
1596
- },
1597
-
1598
-
1599
- async loadConfig(){
1600
- return this.socket.send(this.presetSrc, { key:this.presetKey })
1601
- .then(async ({ config, presets, sharedPresets }) => {
1602
-
1603
- this.config = config
1604
- this.presets = presets
1605
- this.sharedPresets = sharedPresets
1606
-
1607
- if(this.$route.query?.search)
1608
- this.preset.search = this.$route.query.search
1692
+ else {
1693
+ return new Promise((resolve) => {
1694
+ const query = {}
1695
+ for (let key in this.$route.query) {
1696
+ if (key.toLowerCase() !== 'reset')
1697
+ query[key] = this.$route.query[key]
1698
+ }
1699
+ this.$router.replace({
1700
+ ...this.$route,
1701
+ query
1609
1702
  })
1610
- .catch(() => {})
1703
+
1704
+ resolve()
1705
+ })
1706
+ }
1611
1707
  },
1612
1708
 
1613
- saveConfig: invokeAfterIdle(function(reset = false, preset = false){
1709
+ savePreset: invokeAfterIdle(function(reset = false, preset = false){
1614
1710
  if(!this.presetKey) return
1615
1711
  if(!this.config) return
1616
1712
 
1617
1713
  return this.socket.send(this.presetSrc, {
1618
- key:this.presetKey,
1619
- config: {
1620
- ...this.config,
1621
- presets: undefined
1622
- },
1623
- ...(reset ? { reset:true, presets: this.presets } : {}),
1624
- ...(preset ? { presets: [ this.preset ] } : {}),
1714
+ key: this.presetKey,
1715
+ config: this.config,
1625
1716
  })
1626
1717
  .catch(() => {})
1627
1718
  }),
@@ -1637,45 +1728,27 @@ export default {
1637
1728
  .catch(() => {})
1638
1729
  },
1639
1730
 
1640
- savePreset: invokeAfterIdle(async function(){
1641
- if(!this.presetKey) return
1642
- if(!this.selectedPreset) return
1643
-
1644
- return this.socket.send(this.presetSrc, {
1645
- key: this.presetKey,
1646
- presets: [
1647
- this.selectedPreset
1648
- ]
1649
- })
1650
- .catch(() => {})
1651
- }),
1652
-
1653
1731
  },
1654
1732
 
1655
1733
  mounted() {
1656
- this.loadConfig()
1734
+ this.loadPreset()
1657
1735
  .then(_ => this.load())
1658
1736
  },
1659
1737
 
1660
1738
  props: {
1739
+
1740
+ config: Object,
1741
+ defaultConfig: Function,
1661
1742
  presetKey: String,
1662
- presetSrc: {
1743
+
1744
+ controller: {
1663
1745
  type: String,
1664
- default: 'user.preset'
1746
+ required: true
1665
1747
  },
1666
1748
 
1667
- src: String,
1668
-
1669
- datasourceSrc: String,
1670
- datasourceListSrc: String,
1671
-
1672
- previewSrc: String,
1673
-
1674
- sharingSrc: String,
1675
-
1676
- removeSharingSrc: String,
1677
1749
 
1678
1750
  title: String,
1751
+
1679
1752
  },
1680
1753
 
1681
1754
  provide() {
@@ -1689,7 +1762,10 @@ export default {
1689
1762
  getConfig: this.getConfig,
1690
1763
  getPresets: this.getPresets,
1691
1764
  selectPreset: this.selectPreset,
1692
- preview: this.preview
1765
+ preview: this.preview,
1766
+ getSrc: () => this.src,
1767
+ getViewedPreset: () => this.viewedPreset,
1768
+ getQueryFilters: () => this.queryFilters,
1693
1769
  }
1694
1770
  },
1695
1771
 
@@ -1703,25 +1779,26 @@ export default {
1703
1779
  watch: {
1704
1780
 
1705
1781
  'presets'(to) {
1706
- this.cConfig.viewedUid = 'uid' in this.$route.query ? this.$route.query.uid : this.cConfig.viewedUid
1782
+ this.cConfigParams.viewedUid = 'uid' in this.$route.query ? this.$route.query.uid : this.cConfigParams.viewedUid
1707
1783
  },
1708
1784
 
1709
- 'cConfig.viewedUid'() {
1785
+ 'cConfigParams.viewedUid'() {
1710
1786
  this.$emit('change')
1711
1787
  },
1712
1788
 
1713
- 'cConfig.selectedUid'() {
1714
- this.saveConfig()
1789
+ 'cConfig.params.selectedUid'() {
1790
+ this.savePreset()
1791
+ this.presetNameChanging = null
1715
1792
  },
1716
1793
 
1717
1794
  'cConfig.selectedDatasource'() {
1718
- this.saveConfig()
1795
+ this.savePreset()
1719
1796
  },
1720
1797
 
1721
1798
  '$route.query': {
1722
1799
  handler(to) {
1723
1800
  if (this.cConfig) {
1724
- this.cConfig.viewedUid = 'uid' in to ? to.uid : this.cConfig.viewedUid
1801
+ this.cConfigParams.viewedUid = 'uid' in to ? to.uid : this.cConfigParams.viewedUid
1725
1802
  this.load()
1726
1803
  }
1727
1804
  }
@@ -1731,14 +1808,14 @@ export default {
1731
1808
  deep: true,
1732
1809
  handler(to, from){
1733
1810
  if(Object.keys(from ?? {}).length > 0){
1734
- this.saveConfig()
1811
+ this.savePreset()
1735
1812
  }
1736
1813
  }
1737
1814
  },
1738
1815
 
1739
1816
  selectedPreset: {
1740
1817
  deep: true,
1741
- handler(to) {
1818
+ handler(to, from) {
1742
1819
  if(to) {
1743
1820
  this.savePreset()
1744
1821
  }
@@ -1766,8 +1843,14 @@ export default {
1766
1843
  @apply hover:border-primary-300 hover:bg-primary-100;
1767
1844
  }
1768
1845
 
1769
- .columnTextbox input::placeholder {
1770
- @apply text-text;
1846
+ .listMenu{
1847
+ @apply flex flex-row items-center gap-1 hover:bg-text-50 px-3 rounded-xl;
1848
+ }
1849
+ .listMenu .listBtn{
1850
+ @apply hidden p-1;
1851
+ }
1852
+ .listMenu:hover .listBtn{
1853
+ @apply block;
1771
1854
  }
1772
1855
 
1773
1856
  </style>