@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
@@ -3,16 +3,22 @@
3
3
 
4
4
  <TreeViewItem v-for="(item, index) in modelValue"
5
5
  :item="item"
6
+ :depth="0"
6
7
  :parent="modelValue"
7
8
  :selected-item="selectedItem"
8
9
  @moveup="moveUp(item)"
9
10
  @movedown="moveDown(item)"
10
11
  @change="$emit('change')"
11
- @remove="confirm({ title:$t('Remove this item?'), onConfirm: () => { modelValue.splice(index, 1);$emit('change') }})"
12
- @add="(items) => $emit('add', items)">
13
- <template #default="{ item, parent }">
14
- <slot :item="item" :parent="parent"></slot>
12
+ @remove="modelValue.splice(index, 1);$emit('change')"
13
+ @add="(items) => $emit('add', items)"
14
+ @duplicate="(parent, item) => $emit('duplicate', parent, item)">
15
+ <template #default="{ item, parent, depth }">
16
+ <slot :item="item" :parent="parent" :depth="depth"></slot>
15
17
  </template>
18
+
19
+ <template #item="{ item, parent, depth }">
20
+ <slot name="item" :item="item" :parent="parent" :depth="depth"></slot>
21
+ </template>
16
22
  </TreeViewItem>
17
23
 
18
24
  </div>
@@ -21,7 +27,6 @@
21
27
  <script>
22
28
 
23
29
  import TreeViewItem from "./TreeViewItem.vue";
24
- import {copyToClipboard, getClipboardData} from "../utils/helpers.mjs";
25
30
 
26
31
  export default{
27
32
 
@@ -29,7 +34,7 @@ export default{
29
34
 
30
35
  emits: [ 'add', 'change', 'paste' ],
31
36
 
32
- inject: [ 'confirm', 'toast' ],
37
+ inject: [ 'toast' ],
33
38
 
34
39
  props: {
35
40
 
@@ -42,20 +47,20 @@ export default{
42
47
  methods: {
43
48
 
44
49
  copy(){
45
- if(this.selectedItem){
50
+ /*if(this.selectedItem){
46
51
  copyToClipboard(JSON.stringify(this.selectedItem))
47
52
  .then(() => this.toast('Copied to clipboard'))
48
- }
53
+ }*/
49
54
  },
50
55
 
51
56
  paste(){
52
- getClipboardData().then(text => {
57
+ /*getClipboardData().then(text => {
53
58
  try{
54
59
  const item = JSON.parse(text)
55
60
  this.$emit('paste', item)
56
61
  }
57
62
  catch(e){}
58
- })
63
+ })*/
59
64
  },
60
65
 
61
66
  moveDown(item){
@@ -0,0 +1,38 @@
1
+ <template>
2
+ <div :class="$style.comp">
3
+
4
+ <TreeViewItem2 v-for="(item, index) in items"
5
+ :item="item"
6
+ :index="index"
7
+ :parent="items"
8
+ :container-class="containerClass">
9
+ <template #default="{ item, index, parent }">
10
+ <slot :item="item" :index="index" :parent="parent"></slot>
11
+ </template>
12
+ </TreeViewItem2>
13
+
14
+ </div>
15
+ </template>
16
+
17
+ <script setup>
18
+
19
+ import TreeViewItem2 from "./TreeViewItem2.vue";
20
+
21
+
22
+ const { } = defineProps({
23
+
24
+ containerClass: String,
25
+
26
+ items: Array
27
+
28
+ })
29
+
30
+ </script>
31
+
32
+ <style module>
33
+
34
+ .comp {
35
+ @apply flex flex-col gap-1;
36
+ }
37
+
38
+ </style>
@@ -12,24 +12,30 @@
12
12
  <svg v-else width="14" height="14" class="fill-text-300 pointer-events-none" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 192 512"><path d="M0 384.662V127.338c0-17.818 21.543-26.741 34.142-14.142l128.662 128.662c7.81 7.81 7.81 20.474 0 28.284L34.142 398.804C21.543 411.404 0 402.48 0 384.662z"/></svg>
13
13
  </button>
14
14
 
15
- <div class="flex-1 flex px-3">
16
- <slot :item="item" :parent="parent"></slot>
17
- </div>
18
-
19
- <div class="flex flex-row items-center">
20
- <button v-if="item && Array.isArray(item.items)"
21
- type="button"
22
- class="p-1"
23
- @click="add">
24
- <svg width="16" height="16" class="fill-primary" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512"><path d="M376 232H216V72c0-4.42-3.58-8-8-8h-32c-4.42 0-8 3.58-8 8v160H8c-4.42 0-8 3.58-8 8v32c0 4.42 3.58 8 8 8h160v160c0 4.42 3.58 8 8 8h32c4.42 0 8-3.58 8-8V280h160c4.42 0 8-3.58 8-8v-32c0-4.42-3.58-8-8-8z"/></svg>
25
- </button>
26
-
27
- <button type="button"
28
- class="p-1"
29
- @click="$emit('remove')">
30
- <svg width="16" height="16" class="fill-text-300 hover:fill-red-500" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 512"><path d="M193.94 256L296.5 153.44l21.15-21.15c3.12-3.12 3.12-8.19 0-11.31l-22.63-22.63c-3.12-3.12-8.19-3.12-11.31 0L160 222.06 36.29 98.34c-3.12-3.12-8.19-3.12-11.31 0L2.34 120.97c-3.12 3.12-3.12 8.19 0 11.31L126.06 256 2.34 379.71c-3.12 3.12-3.12 8.19 0 11.31l22.63 22.63c3.12 3.12 8.19 3.12 11.31 0L160 289.94 262.56 392.5l21.15 21.15c3.12 3.12 8.19 3.12 11.31 0l22.63-22.63c3.12-3.12 3.12-8.19 0-11.31L193.94 256z"/></svg>
31
- </button>
32
- </div>
15
+ <slot name="item" :item="item" :parent="parent" :depth="depth">
16
+ <div class="flex-1 flex px-3">
17
+ <slot :item="item" :parent="parent"></slot>
18
+ </div>
19
+
20
+ <div class="flex flex-row items-center">
21
+ <button v-if="item && Array.isArray(item.items)"
22
+ type="button"
23
+ class="p-1"
24
+ @click="add">
25
+ <svg width="16" height="16" class="fill-primary" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512"><path d="M376 232H216V72c0-4.42-3.58-8-8-8h-32c-4.42 0-8 3.58-8 8v160H8c-4.42 0-8 3.58-8 8v32c0 4.42 3.58 8 8 8h160v160c0 4.42 3.58 8 8 8h32c4.42 0 8-3.58 8-8V280h160c4.42 0 8-3.58 8-8v-32c0-4.42-3.58-8-8-8z"/></svg>
26
+ </button>
27
+
28
+ <button type="button" class="p-1" @click="duplicate">
29
+ <svg class="fill-text-300 hover:fill-primary" width="13" height="13" 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="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"/></svg>
30
+ </button>
31
+
32
+ <button type="button"
33
+ class="p-1"
34
+ @click="$emit('remove')">
35
+ <svg width="16" height="16" class="fill-text-300 hover:fill-red-500" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 512"><path d="M193.94 256L296.5 153.44l21.15-21.15c3.12-3.12 3.12-8.19 0-11.31l-22.63-22.63c-3.12-3.12-8.19-3.12-11.31 0L160 222.06 36.29 98.34c-3.12-3.12-8.19-3.12-11.31 0L2.34 120.97c-3.12 3.12-3.12 8.19 0 11.31L126.06 256 2.34 379.71c-3.12 3.12-3.12 8.19 0 11.31l22.63 22.63c3.12 3.12 8.19 3.12 11.31 0L160 289.94 262.56 392.5l21.15 21.15c3.12 3.12 8.19 3.12 11.31 0l22.63-22.63c3.12-3.12 3.12-8.19 0-11.31L193.94 256z"/></svg>
36
+ </button>
37
+ </div>
38
+ </slot>
33
39
 
34
40
  </div>
35
41
  <div ref="container"
@@ -39,14 +45,20 @@
39
45
  <TreeViewItem v-for="(subItem, index) in item.items"
40
46
  :item="subItem"
41
47
  :parent="item.items"
48
+ :depth="depth + 1"
42
49
  :selected-item="selectedItem"
43
50
  @moveup="moveUp(subItem)"
44
51
  @movedown="moveDown(subItem)"
45
- @remove="confirm({ title:$t('Remove this item?'), onConfirm: () => { item.items.splice(index, 1);$emit('change') }})"
52
+ @remove="item.items.splice(index, 1); $emit('change')"
46
53
  @add="(items) => $emit('add', items)"
54
+ @duplicate="(parent, item) => $emit('duplicate', parent, item)"
47
55
  @change="$emit('change')">
48
- <template #default="{ item }">
49
- <slot :item="item"></slot>
56
+ <template #default="{ item, parent, depth }">
57
+ <slot :item="item" :parent="parent" :depth="depth"></slot>
58
+ </template>
59
+
60
+ <template #item="{ item, parent, depth }">
61
+ <slot name="item" :item="item" :parent="parent" :depth="depth"></slot>
50
62
  </template>
51
63
  </TreeViewItem>
52
64
  </div>
@@ -62,9 +74,9 @@ export default{
62
74
 
63
75
  name: 'TreeViewItem',
64
76
 
65
- emits: [ 'add', 'change', 'moveup', 'movedown', 'remove' ],
77
+ emits: [ 'add', 'change', 'duplicate', 'moveup', 'movedown', 'remove' ],
66
78
 
67
- inject: [ 'confirm', 'toast', 'store', 'getConfig' ],
79
+ inject: [ 'toast', 'store' ],
68
80
 
69
81
  props: {
70
82
  item: Object,
@@ -77,6 +89,8 @@ export default{
77
89
  type: [ Number, String ],
78
90
  default: 1
79
91
  },
92
+
93
+ depth: Number
80
94
  },
81
95
 
82
96
  methods: {
@@ -102,6 +116,10 @@ export default{
102
116
  this.childCollapsed = false
103
117
  },
104
118
 
119
+ duplicate(){
120
+ this.$emit('duplicate', this.parent, this.item)
121
+ },
122
+
105
123
  mouseDown(e){
106
124
  if(!this.$el || this.$el.nodeType !== 1) return
107
125
 
@@ -299,12 +317,15 @@ export default{
299
317
  computed: {
300
318
 
301
319
  componentStore(){
302
- if(this.store && this.store.components){
303
- if(!this.store.components.treeviewitem)
304
- this.store.components.treeviewitem = {}
320
+ if(!this.store) return this.store
305
321
 
306
- return this.store.components.treeviewitem
307
- }
322
+ if(!this.store.components)
323
+ this.store.components = {}
324
+
325
+ if(!this.store.components.treeviewitem)
326
+ this.store.components.treeviewitem = {}
327
+
328
+ return this.store.components.treeviewitem
308
329
  },
309
330
 
310
331
  isSelected(){
@@ -350,6 +371,14 @@ export default{
350
371
  childCollapsed(to){
351
372
  if(this.item.uid && this.componentStore){
352
373
  this.componentStore[this.item.uid] = to
374
+
375
+ const keys = Object.keys(this.componentStore)
376
+ if(keys.length > 100){
377
+ const removedKeys = keys.slice(0, keys.length - 100)
378
+ for(let i in removedKeys){
379
+ delete this.componentStore[removedKeys[i]]
380
+ }
381
+ }
353
382
  }
354
383
  else{
355
384
  console.warn('[TreeviewItem] not saving collapsed state', {
@@ -402,7 +431,7 @@ export default{
402
431
  <style module>
403
432
 
404
433
  .item{
405
- @apply bg-base-300 dark:bg-base-400 flex flex-row py-1 items-center rounded-lg mb-1;
434
+ @apply bg-base-300 hover:bg-text-50 flex flex-row py-1 items-center rounded-lg mb-1;
406
435
  @apply border-[1px] border-transparent cursor-pointer;
407
436
  }
408
437
  .item.active{
@@ -0,0 +1,55 @@
1
+ <template>
2
+ <div :class="$style.comp">
3
+
4
+ <slot name="default" :item="item" :index="index" :parent="parent">
5
+ <div :class="$style.item">
6
+ <label>{{ item.title }}</label>
7
+ </div>
8
+ </slot>
9
+
10
+ <div v-if="(item.items ?? []).length > 0"
11
+ :class="containerClass ?? $style.subitems">
12
+ <TreeViewItem2 v-for="(subItem, index) in item.items"
13
+ :item="subItem"
14
+ :index="index"
15
+ :parent="item.items"
16
+ :container-class="containerClass">
17
+ <template #default="{ item, index, parent }">
18
+ <slot :item="item" :index="index" :parent="parent"></slot>
19
+ </template>
20
+ </TreeViewItem2>
21
+ </div>
22
+
23
+ </div>
24
+ </template>
25
+
26
+ <script setup>
27
+
28
+ const { } = defineProps({
29
+
30
+ containerClass: String,
31
+
32
+ item: Object,
33
+
34
+ index: Number,
35
+
36
+ parent: Array
37
+ })
38
+
39
+ </script>
40
+
41
+ <style module>
42
+
43
+ .comp{
44
+
45
+ }
46
+
47
+ .item{
48
+ @apply bg-base-400 hover:bg-base-500;
49
+ }
50
+
51
+ .subitems {
52
+ @apply ml-4 flex flex-col gap-1 mt-1;
53
+ }
54
+
55
+ </style>
@@ -0,0 +1,45 @@
1
+ <template>
2
+ <div :class="$style.comp" @click="$refs.file.click()">
3
+ <input type="file" :multiple="Boolean(multiple)" :accept="accept" ref="file" class="hidden" @change="onUpload"/>
4
+ <slot name="default"></slot>
5
+ </div>
6
+ </template>
7
+
8
+ <script>
9
+
10
+ export default{
11
+
12
+ emits: [ 'change' ],
13
+
14
+ props:{
15
+
16
+ accept: undefined,
17
+ multiple: undefined,
18
+
19
+ },
20
+
21
+ methods: {
22
+
23
+ onUpload(e){
24
+ const files = []
25
+ for(let i = 0; i < e.target.files.length; i++){
26
+ files.push(e.target.files[i])
27
+ }
28
+
29
+ this.$emit('change', files)
30
+ this.$refs.file.value = null
31
+ }
32
+
33
+ }
34
+
35
+ }
36
+
37
+ </script>
38
+
39
+ <style module>
40
+
41
+ .comp{
42
+ @apply cursor-pointer;
43
+ }
44
+
45
+ </style>
@@ -0,0 +1,119 @@
1
+ <template>
2
+ <div :class="$style.comp"
3
+ @click="onClick">
4
+ <video v-if="actualSrc" ref="video"
5
+ @ended="playing = false">
6
+ <source :src="actualSrc" type="video/mp4">
7
+ </video>
8
+
9
+ <slot v-else name="empty" :instance="this"></slot>
10
+
11
+ <div v-if="!playing && actualSrc" :class="$style.play">
12
+ <button type="button" @click.stop="play" class="w-[36px] h-[36px] flex items-center justify-center rounded-full bg-white/30">
13
+ <svg width="21" height="21" class="fill-white" 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="M176 480C148.6 480 128 457.6 128 432v-352c0-25.38 20.4-47.98 48.01-47.98c8.686 0 17.35 2.352 25.02 7.031l288 176C503.3 223.8 512 239.3 512 256s-8.703 32.23-22.97 40.95l-288 176C193.4 477.6 184.7 480 176 480z"/></svg>
14
+ </button>
15
+ </div>
16
+
17
+ <input v-if="Boolean(editable)" class="hidden" type="file" accept="video/*" ref="file" @change="onChange"/>
18
+ </div>
19
+ </template>
20
+
21
+ <script>
22
+
23
+ export default{
24
+
25
+ emits: [ 'click', 'change' ],
26
+
27
+ props: {
28
+
29
+ editable:{
30
+ type: [ Boolean, String ],
31
+ default: false
32
+ },
33
+
34
+ src: undefined,
35
+
36
+ },
37
+
38
+ data(){
39
+ return {
40
+ actualSrc: null,
41
+ playing: false,
42
+ }
43
+ },
44
+
45
+ methods: {
46
+
47
+ edit(){
48
+ if(this.$refs.file){
49
+ this.$refs.file.click()
50
+ }
51
+ },
52
+
53
+ onChange(e){
54
+ if(e.target.files.length > 0){
55
+ var reader = new FileReader();
56
+ reader.addEventListener('load', () => {
57
+ this.$emit('change', reader.result, e.target.files[0])
58
+ this.$refs.file.value = null
59
+ }, false)
60
+ reader.readAsDataURL(e.target.files[0]);
61
+ }
62
+ },
63
+
64
+ onClick(e){
65
+ if(this.playing){
66
+ this.$refs.video.pause()
67
+ this.playing = false
68
+ }
69
+ else{
70
+ this.$emit('click', e, this)
71
+ }
72
+ },
73
+
74
+ play(){
75
+ this.$refs.video.play()
76
+ this.playing = true
77
+ }
78
+
79
+ },
80
+
81
+ watch: {
82
+
83
+ src: {
84
+ immediate: true,
85
+ handler(to){
86
+ if(to instanceof File){
87
+ var reader = new FileReader();
88
+ reader.addEventListener('load', () => {
89
+ this.actualSrc = reader.result
90
+ }, false)
91
+ reader.readAsDataURL(to);
92
+ }
93
+ else{
94
+ this.actualSrc = to
95
+ //this.actualSrc = 'https://www.kliknss.co.id/images/big_buck_bunny_240p_1mb.mp4'
96
+ }
97
+ }
98
+ }
99
+
100
+ }
101
+
102
+ }
103
+
104
+ </script>
105
+
106
+ <style module>
107
+
108
+ .comp{
109
+ @apply flex-1 flex items-center justify-center relative overflow-hidden;
110
+ }
111
+
112
+ .play{
113
+ @apply absolute;
114
+ top: 50%;
115
+ left: 50%;
116
+ transform: translate(-50%, -50%);
117
+ }
118
+
119
+ </style>
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <div :class="$style.virtualGrid" @click="resize">
2
+ <div :class="$style.virtualGrid">
3
3
 
4
4
  <div ref="scroller" :class="$style.scroller" :style="scrollerStyle">
5
5
  <div :class="spacerClass" ref="spacer" :style="spacerStyle">
@@ -18,14 +18,14 @@
18
18
  <div class="flex flex-row gap-2 items-center">
19
19
  <small class="text-text-400">Column</small>
20
20
  <select v-model="config.gridColumn"
21
- class="appearance-none outline-none text-text-400 w-[20px] bg-transparent border-[1px] border-text-100 text-center">
21
+ class="appearance-none outline-none text-text-400 w-[20px] bg-transparent border-[1px] border-border-100 text-center">
22
22
  <option v-for="i in 8" :value="i">{{ i }}</option>
23
23
  </select>
24
24
  </div>
25
25
  <div class="flex flex-row gap-2 items-center">
26
26
  <small class="text-text-400">Gap</small>
27
27
  <select v-model="config.gridGap"
28
- class="appearance-none outline-none text-text-400 w-[20px] bg-transparent border-[1px] border-text-100 text-center">
28
+ class="appearance-none outline-none text-text-400 w-[20px] bg-transparent border-[1px] border-border-100 text-center">
29
29
  <option v-for="i in 8" :value="`gap-${i}`">{{ i }}</option>
30
30
  </select>
31
31
  </div>
@@ -82,6 +82,8 @@ export default{
82
82
  this.isOnEndScroll = false
83
83
  }
84
84
  }
85
+
86
+ this.scrolled = this.scrollTop > 0
85
87
  }, 16),
86
88
 
87
89
  init(){
@@ -218,6 +220,8 @@ export default{
218
220
  isOnEndScroll: false,
219
221
  selectedIndex: -1,
220
222
  state: 1,
223
+ scrolled: false,
224
+ scrollerCache: {}
221
225
  }
222
226
  },
223
227
 
@@ -227,11 +231,11 @@ export default{
227
231
 
228
232
  watch: {
229
233
 
230
- column(to){
234
+ column(){
231
235
  this.resize()
232
236
  },
233
237
 
234
- gap(to){
238
+ gap(){
235
239
  this.resize()
236
240
  },
237
241
 
@@ -246,6 +250,19 @@ export default{
246
250
  }
247
251
  },
248
252
 
253
+ scrollerStyle(to){
254
+ if(this.scrolled && this.scrollerCache?.id){
255
+ const index = this.items.findIndex(_ => _.id === this.scrollerCache.id)
256
+ const addToScroll = (index - this.scrollerCache.index) * this.itemHeight
257
+ this.scrollTop = this.$el.scrollTop = this.scrollTop + addToScroll
258
+ }
259
+
260
+ this.scrollerCache = {
261
+ id: (this.items ?? [])[this.visibleStartIndex]?.id,
262
+ index: this.visibleStartIndex
263
+ }
264
+ },
265
+
249
266
  }
250
267
 
251
268
  }
@@ -256,6 +273,7 @@ export default{
256
273
 
257
274
  .virtualGrid{
258
275
  @apply flex-1 overflow-y-auto;
276
+ @apply md:border-[1px] border-border-50 md:bg-base-400;
259
277
  }
260
278
 
261
279
  .scroller{
@@ -268,13 +286,12 @@ export default{
268
286
  .spacer{
269
287
  will-change: auto;
270
288
  position: relative;
271
- @apply grid;
289
+ @apply grid divide-y divide-border-50 border-t-[1px] border-border-50;
272
290
  }
273
291
 
274
292
  .calc{
275
293
  @apply absolute invisible max-w-full;
276
294
  top: -10000px;
277
-
278
295
  }
279
296
 
280
297
  </style>