@mixd-id/web-scaffold 0.2.240706 → 0.2.250801010

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (220) hide show
  1. package/docs/components/Dashboard.md +56 -0
  2. package/log.txt +7 -0
  3. package/package.json +27 -19
  4. package/src/components/404.vue +61 -0
  5. package/src/components/AccountIcon.vue +19 -0
  6. package/src/components/Ahref.vue +1 -1
  7. package/src/components/Alert.vue +4 -13
  8. package/src/components/ArrayList.vue +49 -0
  9. package/src/components/Article.vue +24 -30
  10. package/src/components/Button.vue +83 -169
  11. package/src/components/Card.vue +257 -0
  12. package/src/components/Carousel.vue +61 -60
  13. package/src/components/Cart.vue +192 -0
  14. package/src/components/CartIcon.vue +89 -0
  15. package/src/components/ChartBar.vue +2 -3
  16. package/src/components/Checkbox.vue +20 -11
  17. package/src/components/Checkout.vue +373 -0
  18. package/src/components/CheckoutDelivery.vue +267 -0
  19. package/src/components/CodeEditor.vue +5 -16
  20. package/src/components/CollapsiblePanel.vue +70 -0
  21. package/src/components/ColorPicker.vue +12 -5
  22. package/src/components/ColorPicker2.vue +41 -19
  23. package/src/components/ColorPicker3.vue +100 -0
  24. package/src/components/Confirm.vue +9 -7
  25. package/src/components/ContextMenu.vue +122 -206
  26. package/src/components/ContextMenuItem.vue +53 -0
  27. package/src/components/Dashboard.vue +243 -0
  28. package/src/components/Dashboard2.vue +118 -0
  29. package/src/components/DashboardComponentSelector.vue +96 -0
  30. package/src/components/DashboardConfigs.vue +202 -0
  31. package/src/components/Datepicker.vue +102 -41
  32. package/src/components/DayTimeRange.vue +3 -2
  33. package/src/components/Dropdown.vue +7 -4
  34. package/src/components/Flex.vue +14 -40
  35. package/src/components/GHeatMaps.vue +2 -2
  36. package/src/components/Grid.vue +6 -6
  37. package/src/components/HTMLEditor.vue +27 -14
  38. package/src/components/Image.vue +62 -108
  39. package/src/components/ImagePreview.vue +14 -4
  40. package/src/components/ImageUploader.vue +114 -0
  41. package/src/components/ImportModal.vue +3 -3
  42. package/src/components/Link.vue +62 -6
  43. package/src/components/List.vue +528 -403
  44. package/src/components/ListContextMenu.vue +88 -0
  45. package/src/components/ListItem.vue +6 -4
  46. package/src/components/ListPage1.vue +14 -15
  47. package/src/components/ListView.vue +5 -6
  48. package/src/components/ListViewSettings.vue +2 -2
  49. package/src/components/LogViewerItem.vue +1 -1
  50. package/src/components/MarkdownEdit.vue +128 -0
  51. package/src/components/MarkdownPreview.vue +102 -0
  52. package/src/components/MenuItem1.vue +36 -0
  53. package/src/components/Modal.vue +95 -43
  54. package/src/components/MultiDropdown.vue +124 -0
  55. package/src/components/MultilineText.vue +1 -4
  56. package/src/components/OTPField.vue +40 -26
  57. package/src/components/ObjectTree.vue +1 -1
  58. package/src/components/PageBuilder.vue +3 -3
  59. package/src/components/Paragraph.vue +1 -2
  60. package/src/components/PresetSelectorFilterItem.vue +107 -95
  61. package/src/components/Radio.vue +1 -1
  62. package/src/components/SearchModal.vue +153 -0
  63. package/src/components/Slider.vue +1 -1
  64. package/src/components/Svg.vue +1 -1
  65. package/src/components/SvgEditor.vue +173 -0
  66. package/src/components/Switch.vue +4 -5
  67. package/src/components/Table.vue +2 -2
  68. package/src/components/TableView.vue +2 -3
  69. package/src/components/TableViewHead.vue +2 -2
  70. package/src/components/Tabs.vue +1 -1
  71. package/src/components/Testimonial.vue +2 -2
  72. package/src/components/Text.vue +7 -22
  73. package/src/components/TextEditor.vue +3 -3
  74. package/src/components/TextWithTag.vue +61 -30
  75. package/src/components/Textarea.vue +16 -22
  76. package/src/components/Textbox.vue +9 -19
  77. package/src/components/Timepicker.vue +25 -15
  78. package/src/components/Toast.vue +5 -3
  79. package/src/components/TreeMenu.vue +122 -0
  80. package/src/components/TreeView.vue +15 -10
  81. package/src/components/TreeView2.vue +38 -0
  82. package/src/components/TreeViewItem.vue +58 -29
  83. package/src/components/TreeViewItem2.vue +55 -0
  84. package/src/components/Uploader.vue +45 -0
  85. package/src/components/Video.vue +119 -0
  86. package/src/components/VirtualGrid.vue +24 -7
  87. package/src/components/VirtualTable.vue +363 -128
  88. package/src/configs/dashboard/data-table.js +9 -0
  89. package/src/configs/web-page-builder.js +118 -0
  90. package/src/directives/intersect.js +26 -0
  91. package/src/hooks/device.js +14 -0
  92. package/src/index.js +62 -107
  93. package/src/mixin/component.js +151 -67
  94. package/src/themes/default/index.js +118 -159
  95. package/src/utils/dashboard.js +22 -962
  96. package/src/utils/helpers.cjs +635 -0
  97. package/src/utils/helpers.js +91 -60
  98. package/src/utils/helpers.mjs +245 -12
  99. package/src/utils/importer.js +22 -3
  100. package/src/utils/list.mjs +1509 -0
  101. package/src/utils/preset-selector.cjs +1455 -0
  102. package/src/utils/preset-selector.js +489 -95
  103. package/src/utils/preset-selector.mjs +59 -20
  104. package/src/utils/queue.js +63 -0
  105. package/src/utils/web.mjs +120 -0
  106. package/src/utils/wss.js +38 -36
  107. package/src/utils/wss.mjs +24 -19
  108. package/src/widgets/AhrefSetting.vue +16 -13
  109. package/src/widgets/ArticleSetting.vue +15 -27
  110. package/src/widgets/BackgroundColorSetting.vue +153 -0
  111. package/src/widgets/BorderColorSetting.vue +57 -0
  112. package/src/widgets/BotEditor/BotEditorActions.vue +3 -2
  113. package/src/widgets/BotEditor/BotEditorSettings.vue +21 -0
  114. package/src/widgets/BotEditor.vue +35 -15
  115. package/src/widgets/ButtonSetting.vue +12 -13
  116. package/src/widgets/CarouselSetting.vue +33 -45
  117. package/src/widgets/CartSetting.vue +46 -0
  118. package/src/widgets/CheckoutSetting.vue +46 -0
  119. package/src/widgets/CollapsiblePanelSetting.vue +46 -0
  120. package/src/widgets/ColumnSelector.vue +29 -5
  121. package/src/widgets/ComponentSetting.vue +1 -1
  122. package/src/widgets/ComponentSetting2.vue +145 -236
  123. package/src/widgets/ComponentSetting3.vue +1 -1
  124. package/src/widgets/ContactForm.vue +3 -3
  125. package/src/widgets/ContactFormSetting.vue +41 -30
  126. package/src/widgets/Dashboard/BarChart.vue +47 -11
  127. package/src/widgets/Dashboard/BarChartSetting.vue +1 -1
  128. package/src/widgets/Dashboard/DataTable.vue +125 -0
  129. package/src/widgets/Dashboard/DataTableSetting.vue +243 -0
  130. package/src/widgets/Dashboard/DatasourceSelector.vue +1 -1
  131. package/src/widgets/Dashboard/Doughnut.vue +49 -7
  132. package/src/widgets/Dashboard/DoughnutSetting.vue +2 -2
  133. package/src/widgets/Dashboard/Metric.vue +78 -19
  134. package/src/widgets/Dashboard/MetricSetting.vue +81 -28
  135. package/src/widgets/Dashboard/Pie.vue +55 -6
  136. package/src/widgets/Dashboard/PieSetting.vue +1 -1
  137. package/src/widgets/Dashboard/PolarArea.vue +49 -7
  138. package/src/widgets/Dashboard/PolarAreaSetting.vue +1 -1
  139. package/src/widgets/Dashboard/SharingModal.vue +4 -5
  140. package/src/widgets/Dashboard/ViewSelector.vue +2 -2
  141. package/src/widgets/Dashboard/VirtualTableSetting.vue +121 -184
  142. package/src/widgets/{Dashboard.vue → Dashboard0.vue} +426 -343
  143. package/src/widgets/EmbeddedVideoSetting.vue +7 -5
  144. package/src/widgets/FAQ.vue +16 -3
  145. package/src/widgets/FAQSetting.vue +53 -47
  146. package/src/widgets/FeatureList.vue +3 -0
  147. package/src/widgets/FeatureListSetting.vue +112 -102
  148. package/src/widgets/FlexSetting.vue +83 -106
  149. package/src/widgets/GridSetting.vue +71 -196
  150. package/src/widgets/Header2.vue +34 -71
  151. package/src/widgets/Header2Setting.vue +95 -179
  152. package/src/widgets/HeaderSetting.vue +16 -18
  153. package/src/widgets/IconListSetting.vue +69 -65
  154. package/src/widgets/ImageSetting.vue +33 -60
  155. package/src/widgets/LinkSetting.vue +60 -37
  156. package/src/widgets/LinkSettingModal.vue +173 -0
  157. package/src/widgets/LogViewer.vue +1 -1
  158. package/src/widgets/MarginSetting.vue +2 -2
  159. package/src/widgets/MenuEditor.vue +1 -1
  160. package/src/widgets/MenuItem1Setting.vue +78 -0
  161. package/src/widgets/ModalSetting.vue +42 -44
  162. package/src/widgets/MultiValueSetting.vue +2 -2
  163. package/src/widgets/MultiValueSetting2.vue +78 -45
  164. package/src/widgets/OGSettingModal.vue +103 -0
  165. package/src/widgets/PaddingSetting.vue +2 -2
  166. package/src/widgets/ParagraphSetting.vue +16 -13
  167. package/src/widgets/PositionSetting.vue +209 -0
  168. package/src/widgets/PresetBar.vue +359 -210
  169. package/src/widgets/PresetBarPivot.vue +31 -19
  170. package/src/widgets/PresetSelector.vue +29 -17
  171. package/src/widgets/SearchModalSetting.vue +70 -0
  172. package/src/widgets/Share.vue +1 -2
  173. package/src/widgets/ShareSetting.vue +67 -60
  174. package/src/widgets/StyleSetting.vue +365 -150
  175. package/src/widgets/TestimonialSetting.vue +97 -88
  176. package/src/widgets/TextBlockSetting.vue +16 -13
  177. package/src/widgets/UserActionBuilder/UserActionConsole.vue +30 -10
  178. package/src/widgets/UserActionBuilder/UserActionOutput.vue +2 -2
  179. package/src/widgets/UserActionBuilder/UserActionOutputReply.vue +64 -87
  180. package/src/widgets/UserActionBuilder/UserActionProps.vue +3 -3
  181. package/src/widgets/UserActionBuilder.vue +4 -16
  182. package/src/widgets/WebComponentSelector.vue +15 -11
  183. package/src/widgets/WebLayoutSelector.vue +41 -270
  184. package/src/widgets/WebPageBuilder.vue +1019 -707
  185. package/src/widgets/WebPageBuilder2.vue +7 -7
  186. package/src/widgets/WebPageBuilder4/ButtonSetting.vue +0 -8
  187. package/src/widgets/WebPageBuilder4/CarouselSetting.vue +63 -7
  188. package/src/widgets/WebPageBuilder4/FlexAlignSetting.vue +3 -3
  189. package/src/widgets/WebPageBuilder4/FlexSetting.vue +1 -10
  190. package/src/widgets/WebPageBuilder4/MultiValueSetting.vue +2 -2
  191. package/src/widgets/WebPageBuilder4/PropertySetting.vue +0 -7
  192. package/src/widgets/WebPageBuilder4/WebPageComponentSelector.vue +1 -7
  193. package/src/widgets/WebPageBuilder4.vue +289 -575
  194. package/src/widgets/WebPageSelector.vue +1 -1
  195. package/src/widgets/YoutubeVideoSetting.vue +16 -13
  196. package/tailwind.config.js +3 -35
  197. package/docs/schema/user-action.json +0 -266
  198. package/src/App.vue +0 -25
  199. package/src/components/SearchButton.vue +0 -57
  200. package/src/entry-client.js +0 -27
  201. package/src/entry-server.js +0 -73
  202. package/src/events/event.js +0 -2
  203. package/src/main.js +0 -29
  204. package/src/mixin/website.js +0 -121
  205. package/src/router.js +0 -57
  206. package/src/widgets/MobileMenu.vue +0 -182
  207. package/src/widgets/WebPageBuilder4/ActionSetting.vue +0 -158
  208. package/src/widgets/WebPageBuilder4/ColorSetting.vue +0 -63
  209. package/src/widgets/WebPageBuilder4/DataSetting.vue +0 -92
  210. package/src/widgets/WebPageBuilder4/FontSizeSetting.vue +0 -76
  211. package/src/widgets/WebPageBuilder4/LinkSetting.vue +0 -68
  212. package/src/widgets/WebPageBuilder4/MobileMenuSetting.vue +0 -106
  213. package/src/widgets/WebPageBuilder4/Setting.vue +0 -73
  214. package/src/widgets/WebPageBuilder4/StyleSetting.vue +0 -77
  215. package/src/widgets/WebPageBuilder4/SvgSetting.vue +0 -207
  216. package/src/widgets/WebPageBuilder4/TextTransformSetting.vue +0 -70
  217. package/src/widgets/WebPageBuilder4/WebPageDataEdit.vue +0 -121
  218. package/test.json +0 -22
  219. /package/src/widgets/{Header1.vue → Header0.vue} +0 -0
  220. /package/src/widgets/{Header1Setting.vue → Header0Setting.vue} +0 -0
@@ -1,66 +1,42 @@
1
1
  <template>
2
- <div :class="$style.comp">
3
- <div class="flex-1 flex md:max-w-[200px]">
4
- <Image :src="logoUrl" class="h-[48px]"/>
5
- <Modal ref="mobileMenu" dismissable="true" position="right" @dismiss="$refs.mobileMenu.close()"
6
- class="w-full max-w-[80vw] h-screen max-h-[100vh] rounded-none">
7
- <template v-slot:head>
8
- <div class="p-5 pb-0">
9
- <div class="flex flex-row gap-3 items-center p-3">
10
- <h5 class="flex-1"></h5>
11
- <button type="button" @click="$refs.mobileMenu.close()">
12
- <svg width="21" height="21" class="fill-text" 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>
13
- </button>
14
- </div>
15
- </div>
16
- </template>
17
- <template #foot>
18
- <div class="p-5 flex flex-col gap-4">
19
- <p class="leading-relaxed" v-html="loginHtml"></p>
20
- <div class="flex flex-row gap-2">
21
- <Button class="px-5">{{ registerText ?? $t('Register') }}</Button>
22
- <Button class="px-5" variant="outline">{{ loginText ?? $t('Sign In')}}</Button>
23
- </div>
24
- <br />
25
- </div>
26
- </template>
27
- <div class="flex-1 p-5 flex flex-col gap-6">
2
+ <div :class="$style.comp"
3
+ :style="computedStyle">
4
+ <div class="flex flex-row items-center md:hidden">
5
+ <slot name="mobileMenu">
6
+ <component v-for="comp in slots.mobileMenu"
7
+ :is="`${comp.type}`"
8
+ :key="comp.uid"
9
+ :="comp" />
10
+ </slot>
11
+ </div>
28
12
 
29
- <div>
30
- <div v-for="item in menu" class="flex flex-col">
31
- <div class="flex flex-row gap-3 items-center p-3">
32
- <h5 class="flex-1">{{ item.text }}</h5>
33
- <svg width="16" height="16" class="fill-text" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 512"><path d="M17.525 36.465l-7.071 7.07c-4.686 4.686-4.686 12.284 0 16.971L205.947 256 10.454 451.494c-4.686 4.686-4.686 12.284 0 16.971l7.071 7.07c4.686 4.686 12.284 4.686 16.97 0l211.051-211.05c4.686-4.686 4.686-12.284 0-16.971L34.495 36.465c-4.686-4.687-12.284-4.687-16.97 0z"/></svg>
34
- </div>
35
- <div v-if="item.items" class="ml-4">
36
- <div v-for="item in item.items" class="flex flex-row gap-3 items-center p-3">
37
- <h5 class="flex-1">{{ item.text }}</h5>
38
- </div>
39
- </div>
40
- </div>
41
- </div>
13
+ <div class="flex flex-1 md:flex-none">
14
+ <slot name="left">
15
+ <component v-for="comp in slots.left"
16
+ :is="`${comp.type}`"
17
+ :key="comp.uid"
18
+ :="comp" />
19
+ </slot>
20
+ </div>
42
21
 
43
- </div>
44
- </Modal>
22
+ <div class="hidden flex-1 md:flex flex-row justify-center">
23
+ <slot name="mid">
24
+ <component v-for="comp in slots.mid"
25
+ :is="`${comp.type}`"
26
+ :key="comp.uid"
27
+ :="comp" />
28
+ </slot>
45
29
  </div>
46
30
 
47
- <div class="hidden flex-1 md:flex flex-row gap-4">
48
- <div v-for="item in menu" class="px-3">
49
- <h5>{{ item.text }}</h5>
50
- </div>
31
+ <div>
32
+ <slot name="right">
33
+ <component v-for="comp in slots.right"
34
+ :is="`${comp.type}`"
35
+ :key="comp.uid"
36
+ :="comp" />
37
+ </slot>
51
38
  </div>
52
39
 
53
- <div class="flex flex-row items-center">
54
- <button type="button" v-for="icon in icons" class="p-2">
55
- <Image :src="imageSrc(icon.imageUrl)" class="w-[28px] aspect-square" :edit-selectable="false" />
56
- </button>
57
- <button class="p-4" @click="$refs.mobileMenu.open()">
58
- <svg width="28" height="28" class="fill-text" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
59
- <path fill-rule="evenodd" clip-rule="evenodd" d="M4.25 16C4.25 15.5858 4.58579 15.25 5 15.25H19C19.4142 15.25 19.75 15.5858 19.75 16C19.75 16.4142 19.4142 16.75 19 16.75H5C4.58579 16.75 4.25 16.4142 4.25 16Z"/>
60
- <path fill-rule="evenodd" clip-rule="evenodd" d="M4.25 8C4.25 7.58579 4.58579 7.25 5 7.25H19C19.4142 7.25 19.75 7.58579 19.75 8C19.75 8.41421 19.4142 8.75 19 8.75H5C4.58579 8.75 4.25 8.41421 4.25 8Z"/>
61
- </svg>
62
- </button>
63
- </div>
64
40
  </div>
65
41
  </template>
66
42
 
@@ -73,20 +49,7 @@ export default{
73
49
  mixins: [ componentMixin ],
74
50
 
75
51
  props: {
76
- images: Object,
77
- menu: Array,
78
- icons: Array,
79
- loginHtml: String,
80
- loginText: String,
81
- registerText: String,
82
- },
83
-
84
- computed: {
85
-
86
- logoUrl(){
87
- return import.meta.env.VITE_IMAGE_HOST + '/' + (this.images ?? {}).logo
88
- }
89
-
52
+ slots: Object,
90
53
  }
91
54
 
92
55
  }
@@ -96,7 +59,7 @@ export default{
96
59
  <style module>
97
60
 
98
61
  .comp{
99
- @apply bg-white flex flex-row items-center;
62
+ @apply flex flex-row items-center p-4 md:px-8;
100
63
  }
101
64
 
102
65
  </style>
@@ -1,218 +1,108 @@
1
1
  <template>
2
- <div class="flex flex-col gap-6">
2
+ <div :class="$style.comp">
3
3
 
4
- <div class="flex flex-col gap-6">
4
+ <div class="p-6 flex flex-col gap-6">
5
5
 
6
6
  <div>
7
- <div class="flex flex-row gap-2">
8
- <label class="text-text-400 flex-1">Logo</label>
9
- <button type="button" class="text-primary" @click="$refs.image.edit()">Change</button>
10
- </div>
11
- <div class="mt-1">
12
- <div :class="$style.imageBg">
13
- <Image ref="image" :src="logoSrc"
14
- class="w-[100px] min-h-[48px]"
15
- :editable="true"
16
- @click="$refs.image.edit()"
17
- @change="(base64, file) => { uploadImage(file).then((res) => item.props.images.logo = res.name); $emit('change') }" />
7
+ <div class="flex flex-row items-start">
8
+ <div>
9
+ <label class="text-text-400 flex-1">Left Area</label>
10
+ <p class="text-sm text-text-400">Container for left area of header, usually for logo image</p>
18
11
  </div>
12
+ <button type="button"
13
+ class="text-primary text-sm"
14
+ @click="openComponentSelector({ callback:(component) => item.slots.left.push(component) })">
15
+ Add
16
+ </button>
19
17
  </div>
18
+ <TreeView class="mt-2"
19
+ v-model="item.slots.left"
20
+ @add="(items) => openComponentSelector({ callback:(component) => items.push(component) })"
21
+ @duplicate="duplicate">
22
+ <template #default="{ item }">
23
+ <div class="flex-1 text-ellipsis whitespace-nowrap overflow-hidden"
24
+ :class="!item.props.enabled ? 'line-through' : ''"
25
+ @click="openRightPane2(item)">
26
+ {{ item.name ?? item.type }}
27
+ </div>
28
+ </template>
29
+ </TreeView>
20
30
  </div>
21
31
 
22
32
  <div>
23
- <div class="flex flex-row gap-2 items-center">
24
- <label class="text-text-400 flex-1">Menu</label>
33
+ <div class="flex flex-row items-start">
34
+ <div>
35
+ <label class="text-text-400 flex-1">Mid Area</label>
36
+ <p class="text-sm text-text-400">Container for mid area, not displayed in mobile view, usually for main menu</p>
37
+ </div>
25
38
  <button type="button"
26
- class="text-primary flex flex-row gap-1 px-1"
27
- @click="$refs.menuEdit.open({ target:menu, item:{ items:[] } })">
28
- <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>
39
+ class="text-primary text-sm"
40
+ @click="openComponentSelector({ callback:(component) => item.slots.mid.push(component) })">
29
41
  Add
30
42
  </button>
31
43
  </div>
32
44
  <TreeView class="mt-2"
33
- v-model="menu"
34
- @add="(items) => $refs.menuEdit.open({ target:items, item:{} })"
35
- @change="$emit('change')">
36
- <template #default="{ item, parent }">
37
- <div class="flex-1 flex flex-row gap-2"
38
- @click="$refs.menuEdit.open({ target:parent, item, index:parent.indexOf(item) })">
39
- <div class="flex-1">
40
- {{ item.text }}
41
- </div>
45
+ v-model="item.slots.mid"
46
+ @add="(items) => openComponentSelector({ callback:(component) => items.push(component) })"
47
+ @duplicate="duplicate">
48
+ <template #default="{ item }">
49
+ <div class="flex-1 text-ellipsis whitespace-nowrap overflow-hidden"
50
+ :class="!item.props.enabled ? 'line-through' : ''"
51
+ @click="openRightPane2(item)">
52
+ {{ item.name ?? item.type }}
42
53
  </div>
43
54
  </template>
44
55
  </TreeView>
45
-
46
- <Modal ref="menuEdit" class="w-[360px] h-[360px]">
47
- <template v-slot:head>
48
- <div class="relative p-5">
49
- <h3>Menu Setting</h3>
50
- <div class="absolute top-0 right-0 p-2">
51
- <button type="button" class="p-2" @click="$refs.menuEdit.close()">
52
- <svg width="24" height="24" viewBox="0 0 24 24" class="fill-text-300 hover:fill-red-500" xmlns="http://www.w3.org/2000/svg">
53
- <path d="M6.53034 5.46965C6.23745 5.17676 5.76257 5.17676 5.46968 5.46965C5.17679 5.76255 5.17679 6.23742 5.46968 6.53031L10.9393 12L5.46967 17.4697C5.17678 17.7626 5.17678 18.2374 5.46967 18.5303C5.76256 18.8232 6.23744 18.8232 6.53033 18.5303L12 13.0606L17.4697 18.5303C17.7626 18.8232 18.2375 18.8232 18.5303 18.5303C18.8232 18.2374 18.8232 17.7626 18.5303 17.4697L13.0607 12L18.5303 6.53032C18.8232 6.23743 18.8232 5.76256 18.5303 5.46966C18.2374 5.17677 17.7626 5.17677 17.4697 5.46966L12 10.9393L6.53034 5.46965Z"/>
54
- </svg>
55
- </button>
56
- </div>
57
- </div>
58
- </template>
59
- <template #foot="{ context }">
60
- <div class="p-5">
61
- <Button class="w-[120px]"
62
- @click="'index' in context ?
63
- Object.assign(context.target[context.index], context.item) :
64
- context.target.push(context.item);
65
- $refs.menuEdit.close();
66
- $emit('change')">
67
- Add
68
- </Button>
69
- </div>
70
- </template>
71
- <template #default="{ context }">
72
- <div class="flex-1 p-5 flex flex-col gap-6">
73
-
74
- <div>
75
- <label class="text-text-400">Text</label>
76
- <Textbox v-model="context.item.text" />
77
- </div>
78
-
79
- <div>
80
- <label class="text-text-400">Target</label>
81
- <Textbox v-model="context.item.target" />
82
- </div>
83
-
84
- </div>
85
- </template>
86
- </Modal>
87
56
  </div>
88
57
 
89
- <div class="flex flex-col gap-2">
90
- <div class="flex flex-row gap-2">
91
- <label class="flex-1 text-text-400 flex-1">Icons</label>
58
+ <div>
59
+ <div class="flex flex-row items-start">
60
+ <div>
61
+ <label class="text-text-400 flex-1">Right Area</label>
62
+ <p class="text-sm text-text-400">Container for right area, usually for icon-type menu</p>
63
+ </div>
92
64
  <button type="button"
93
- class="text-primary flex flex-row gap-1 px-1"
94
- @click="$refs.iconModal.open({ item:{} })">
95
- <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>
65
+ class="text-primary text-sm"
66
+ @click="openComponentSelector({ callback:(component) => item.slots.right.push(component) })">
96
67
  Add
97
68
  </button>
98
69
  </div>
99
- <div v-if="icons.length < 1" class="bg-text-50 text-center p-3 text-text-400">
100
- {{ $t('No Icons') }}
101
- </div>
102
- <div v-else>
103
- <TreeView v-model="icons"
104
- @change="$emit('change')">
105
- <template #default="{ item, parent }">
106
- <div class="flex-1 flex flex-row gap-2 items-center"
107
- @click="$refs.iconModal.open({ item, index:parent.indexOf(item) })">
108
- <div>
109
- <Image :src="imageSrc(item.imageUrl)" class="w-[26px] aspect-square bg-text-50 rounded-lg" />
110
- </div>
111
- <div class="flex-1">
112
- {{ item.type }}
113
- </div>
114
- </div>
115
- </template>
116
- </TreeView>
117
- </div>
118
-
119
- <Modal ref="iconModal" class="w-[400px] h-[300px]">
120
- <template v-slot:head>
121
- <div class="relative p-5">
122
- <h3>Add Icon</h3>
123
- <div class="absolute top-0 right-0 p-2">
124
- <button type="button" class="p-2" @click="$refs.iconModal.close()">
125
- <svg width="24" height="24" viewBox="0 0 24 24" class="fill-text-300 hover:fill-red-500" xmlns="http://www.w3.org/2000/svg">
126
- <path d="M6.53034 5.46965C6.23745 5.17676 5.76257 5.17676 5.46968 5.46965C5.17679 5.76255 5.17679 6.23742 5.46968 6.53031L10.9393 12L5.46967 17.4697C5.17678 17.7626 5.17678 18.2374 5.46967 18.5303C5.76256 18.8232 6.23744 18.8232 6.53033 18.5303L12 13.0606L17.4697 18.5303C17.7626 18.8232 18.2375 18.8232 18.5303 18.5303C18.8232 18.2374 18.8232 17.7626 18.5303 17.4697L13.0607 12L18.5303 6.53032C18.8232 6.23743 18.8232 5.76256 18.5303 5.46966C18.2374 5.17677 17.7626 5.17677 17.4697 5.46966L12 10.9393L6.53034 5.46965Z"/>
127
- </svg>
128
- </button>
129
- </div>
130
- </div>
131
- </template>
132
- <template v-slot:foot="{ context }">
133
- <div class="p-5">
134
- <Button class="w-[150px]"
135
- :state="context.item.imageUrl && context.item.type ? 1 : -1"
136
- @click="'index' in context ?
137
- Object.assign(icons[context.index], context.item) :
138
- icons.push(context.item);
139
- $refs.iconModal.close();
140
- $emit('change')">
141
- Add Icon
142
- </Button>
143
- </div>
144
- </template>
145
- <template #default="{ context }">
146
- <div class="flex-1 p-5 flex flex-row gap-6">
147
-
148
- <div>
149
- <div class="flex flex-row gap-2 mb-1">
150
- <label class="flex-1 text-text-400">Icon</label>
151
- <button type="button" @click="$refs.iconModalImage.edit()">
152
- <svg width="14" height="14" class="fill-primary" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512"><path d="M528 288H384v-32h64c42.6 0 64.2-51.7 33.9-81.9l-160-160c-18.8-18.8-49.1-18.7-67.9 0l-160 160c-30.1 30.1-8.7 81.9 34 81.9h64v32H48c-26.5 0-48 21.5-48 48v128c0 26.5 21.5 48 48 48h480c26.5 0 48-21.5 48-48V336c0-26.5-21.5-48-48-48zm-400-80L288 48l160 160H336v160h-96V208H128zm400 256H48V336h144v32c0 26.5 21.5 48 48 48h96c26.5 0 48-21.5 48-48v-32h144v128zm-40-64c0 13.3-10.7 24-24 24s-24-10.7-24-24 10.7-24 24-24 24 10.7 24 24z"/></svg>
153
- </button>
154
- </div>
155
- <Image ref="iconModalImage"
156
- :src="imageSrc(context.item.imageUrl)"
157
- @click="$refs.iconModalImage.edit()"
158
- :editable="true"
159
- @change="(_, file) => context.item.imageUrl = file"
160
- class="w-[90px] aspect-square bg-text-50 rounded-lg" />
161
- </div>
162
-
163
- <div class="flex-1 flex flex-col gap-4">
164
-
165
- <div>
166
- <label class="text-text-400 block mb-1">Type</label>
167
- <Dropdown v-model="context.item.type">
168
- <option disabled selected>{{ $t('Choose Type')}}</option>
169
- <option value="account">Account</option>
170
- <option value="cart">Cart</option>
171
- <option value="search">Search</option>
172
- <option value="custom">Custom</option>
173
- </Dropdown>
174
- </div>
175
-
176
- <div v-if="context.item.type === 'custom'">
177
- <label class="text-text-400 block mb-1">Target</label>
178
- <Textbox v-model="context.item.target" />
179
- </div>
180
-
181
- </div>
182
-
70
+ <TreeView class="mt-2"
71
+ v-model="item.slots.right"
72
+ @add="(items) => openComponentSelector({ callback:(component) => items.push(component) })"
73
+ @duplicate="duplicate">
74
+ <template #default="{ item }">
75
+ <div class="flex-1 text-ellipsis whitespace-nowrap overflow-hidden"
76
+ :class="!item.props.enabled ? 'line-through' : ''"
77
+ @click="openRightPane2(item)">
78
+ {{ item.name ?? item.type }}
183
79
  </div>
184
80
  </template>
185
- </Modal>
186
- </div>
187
-
188
- <div class="flex flex-col gap-2">
189
- <label class="text-text-400 flex-1">Login Area</label>
190
- <HTMLEditor v-model="item.props.loginHtml"
191
- @change="$emit('change')" />
192
- <div class="grid grid-cols-2 gap-2">
193
- <Textbox v-model="item.props.registerText"
194
- placeholder="Register"
195
- @keyup.enter="$emit('change')"
196
- @blur="$emit('change')" />
197
- <Textbox v-model="item.props.loginText"
198
- placeholder="Login"
199
- @keyup.enter="$emit('change')"
200
- @blur="$emit('change')" />
201
- </div>
81
+ </TreeView>
202
82
  </div>
203
83
 
204
84
  </div>
205
85
 
86
+ <ComponentSetting2 :item="item"
87
+ :view-type="viewType"
88
+ :view-types="viewTypes"
89
+ :view-index="viewIndex"
90
+ defaultDisplay="block"
91
+ @change="$emit('change')" />
92
+
206
93
  </div>
207
94
  </template>
208
95
 
209
96
  <script>
210
97
 
98
+ import Image from "../components/Image.vue";
99
+
211
100
  export default{
101
+ components: {Image},
212
102
 
213
103
  emits: [ 'change' ],
214
104
 
215
- inject: [ 'alert', 'imageSrc', 'uploadImage' ],
105
+ inject: [ 'alert', 'duplicate', 'imageSrc', 'uploadImage', 'openComponentSelector', 'openRightPane2' ],
216
106
 
217
107
  props: {
218
108
 
@@ -223,18 +113,35 @@ export default{
223
113
 
224
114
  viewType: String,
225
115
 
116
+ viewIndex: Number,
117
+
226
118
  viewTypes: Array,
227
119
 
228
120
  },
229
121
 
230
122
  computed: {
231
123
 
124
+ slotHeaders(){
125
+ return this.item.slots.headers
126
+ },
127
+
128
+ logo(){
129
+ if(!this.item.props.images){
130
+ this.item.props.images = {}
131
+ }
132
+ if(!Array.isArray(this.item.props.images.logo)){
133
+ this.item.props.images.logo = []
134
+ }
135
+
136
+ return this.item.props.images.logo
137
+ },
138
+
232
139
  logoSrc(){
233
140
  if(!this.item.props.images){
234
141
  this.item.props.images = {}
235
142
  }
236
143
 
237
- return typeof this.item.props.images .logo === 'string' ?
144
+ return typeof this.item.props.images.logo === 'string' ?
238
145
  import.meta.env.VITE_IMAGE_HOST + '/' + this.item.props.images.logo :
239
146
  this.item.props.images.logo
240
147
  },
@@ -259,8 +166,13 @@ export default{
259
166
 
260
167
  methods: {
261
168
 
169
+ },
262
170
 
263
- }
171
+ data(){
172
+ return {
173
+ value: null
174
+ }
175
+ }
264
176
 
265
177
  }
266
178
 
@@ -268,6 +180,10 @@ export default{
268
180
 
269
181
  <style module>
270
182
 
183
+ .comp{
184
+ @apply flex flex-col divide-y divide-border-50;
185
+ }
186
+
271
187
  .imageBg{
272
188
  @apply p-2 bg-white;
273
189
  background-image: radial-gradient(rgba(var(--primary-500)) 1px, transparent 1px);
@@ -1,15 +1,10 @@
1
1
  <template>
2
- <div class="flex flex-col gap-10">
2
+ <div :class="$style.comp">
3
3
 
4
- <div class="flex flex-col gap-6">
5
-
6
- <div>
7
- <strong class="text-text-400">Header</strong>
8
- <div class="h-[1px] bg-text-100 mt-2"></div>
9
- </div>
4
+ <div class="flex flex-col gap-6 p-6">
10
5
 
11
6
  <div class="flex flex-col gap-1">
12
- <label class="flex-1 text-text-400">Model</label>
7
+ <small class="flex-1 text-text-400">Model</small>
13
8
  <Dropdown v-model="item.props.variant"
14
9
  @change="$emit('change')">
15
10
  <option value="Header1">Model 1</option>
@@ -21,14 +16,17 @@
21
16
  :item="item"
22
17
  :view-type="viewType"
23
18
  :view-types="viewTypes"
19
+ :view-index="viewIndex"
24
20
  @change="$emit('change')" />
25
21
 
26
22
  </div>
27
23
 
28
- <ComponentSetting2 :item="item"
29
- :view-type="viewType"
30
- :view-types="viewTypes"
31
- @change="$emit('change')" />
24
+ <ComponentSetting2 :item="item"
25
+ :view-type="viewType"
26
+ :view-types="viewTypes"
27
+ :view-index="viewIndex"
28
+ defaultDisplay="block"
29
+ @change="$emit('change')" />
32
30
 
33
31
  </div>
34
32
  </template>
@@ -48,9 +46,11 @@ export default{
48
46
  required: true
49
47
  },
50
48
 
51
- viewType: String,
49
+ viewType: String,
50
+
51
+ viewIndex: Number,
52
52
 
53
- viewTypes: Array,
53
+ viewTypes: Array,
54
54
 
55
55
  },
56
56
 
@@ -95,10 +95,8 @@ export default{
95
95
 
96
96
  <style module>
97
97
 
98
- .imageBg{
99
- @apply p-2 bg-white;
100
- background-image: radial-gradient(rgba(var(--primary-500)) 1px, transparent 1px);
101
- background-size: calc(10 * 1px) calc(10 * 1px);
98
+ .comp{
99
+ @apply flex flex-col divide-y divide-border-50;
102
100
  }
103
101
 
104
102
  </style>