@mixd-id/web-scaffold 0.2.240706 → 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 -403
  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
@@ -0,0 +1,173 @@
1
+ <template>
2
+ <Modal ref="modal" width="360" height="420">
3
+ <template v-slot:head>
4
+ <div class="relative p-5">
5
+ <h3>Add Menu</h3>
6
+ <div class="absolute top-0 right-0 p-2">
7
+ <button type="button" class="p-2" @click="$refs.modal.close()">
8
+ <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">
9
+ <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"/>
10
+ </svg>
11
+ </button>
12
+ </div>
13
+ </div>
14
+ </template>
15
+
16
+ <template #default>
17
+ <div class="flex-1 p-5 flex flex-col gap-4">
18
+
19
+ <div class="flex flex-row gap-4">
20
+ <div>
21
+ <label class="text-text-400">Image</label>
22
+ <Image ref="image"
23
+ class="w-[64px] aspect-square bg-base-300 border-[1px] border-border-200 rounded-lg"
24
+ :src="imageSrc(instance.image)"
25
+ :editable="true"
26
+ @click="$refs.image.edit()"
27
+ @change="(_, file) => instance.image = file" />
28
+ </div>
29
+ <div class="flex-1">
30
+ <label class="text-text-400">Text</label>
31
+ <Textbox v-model="instance.text" maxlength="50" />
32
+ </div>
33
+ </div>
34
+
35
+ <div>
36
+ <label class="text-text-400">Mode</label>
37
+ <Dropdown v-model="instance.mode">
38
+ <option disabled selected>-Select Mode-</option>
39
+ <option value="parent">Parent</option>
40
+ <option value="route">Route</option>
41
+ <option value="action">Action</option>
42
+ <option value="link">Link</option>
43
+ </Dropdown>
44
+ </div>
45
+
46
+ <div v-if="instance.mode === 'route'"
47
+ class="flex flex-col gap-4">
48
+ <div>
49
+ <label class="text-text-400">Target</label>
50
+ <div class="flex flex-row gap-2">
51
+ <Dropdown v-model="instance.route.type"
52
+ class="w-[100px]">
53
+ <option disabled selected>Choose Type</option>
54
+ <option value="name">Name</option>
55
+ <option value="path">Path</option>
56
+ <option value="hash">Hash</option>
57
+ </Dropdown>
58
+ <Dropdown v-if="instance.route.type === 'name'"
59
+ v-model="instance.route.name"
60
+ class="flex-1">
61
+ <option value="Home">Home</option>
62
+ <option value="Cart">Cart</option>
63
+ <option value="Search">Search</option>
64
+ <option value="AccountProfile">Account Profile</option>
65
+ <option value="AccountHistory">Account History</option>
66
+ </Dropdown>
67
+ <Textbox v-else-if="instance.route.type === 'path'" class="flex-1" v-model="instance.route.path" />
68
+ <Textbox v-else-if="instance.route.type === 'hash'" class="flex-1" v-model="instance.route.hash" />
69
+ </div>
70
+ </div>
71
+ </div>
72
+
73
+ <div v-else-if="instance.mode === 'action'"
74
+ class="flex flex-col gap-4">
75
+ <Dropdown v-model="instance.action.name">
76
+ <option value="" disabled selected>-Choose-</option>
77
+ <option value="search">Search</option>
78
+ </Dropdown>
79
+ </div>
80
+
81
+ <div v-if="instance.mode === 'link'" class="flex flex-col gap-4">
82
+ <div>
83
+ <label class="text-text-400">Target</label>
84
+ <div class="flex flex-row gap-2">
85
+ <Textbox class="flex-1" v-model="instance.link.href" />
86
+ </div>
87
+ </div>
88
+
89
+ <div>
90
+ <label class="text-text-400">Target</label>
91
+ <Dropdown v-model="instance.link.target">
92
+ <option value="_self">Self</option>
93
+ <option value="_blank">Blank</option>
94
+ <option value="_parent">Parent</option>
95
+ <option value="_top">Top</option>
96
+ </Dropdown>
97
+ </div>
98
+ </div>
99
+
100
+ </div>
101
+ </template>
102
+
103
+ <template #foot>
104
+ <div class="p-5">
105
+ <Button ref="saveBtn" class="w-[90px]"
106
+ :state="canSave ? 1 : -1"
107
+ @click="save">
108
+ Save
109
+ </Button>
110
+ </div>
111
+ </template>
112
+ </Modal>
113
+ </template>
114
+
115
+ <script setup>
116
+
117
+ import {computed, inject, ref, useTemplateRef} from "vue";
118
+
119
+ const modal = useTemplateRef('modal')
120
+ const imageSrc = inject('imageSrc')
121
+ const instance = ref(null)
122
+ const callback = ref(null)
123
+
124
+ const canSave = computed(() => {
125
+ return !!instance.value.text
126
+ })
127
+
128
+ function open(obj = {}, cb){
129
+ instance.value = Object.assign({
130
+ route:{},
131
+ action:{},
132
+ link:{
133
+ target: "_self"
134
+ },
135
+ download:{}
136
+ }, obj)
137
+
138
+ callback.value = cb
139
+
140
+ modal.value.open()
141
+ }
142
+
143
+ function save(){
144
+ if(!canSave.value) return
145
+
146
+ const obj = {
147
+ image: instance.value.image,
148
+ text: instance.value.text,
149
+ mode: instance.value.mode,
150
+ [instance.value.mode]: instance.value[instance.value.mode]
151
+ }
152
+ if(obj.mode === 'parent')
153
+ obj.items = []
154
+
155
+ if(typeof callback.value === 'function')
156
+ callback.value(obj)
157
+
158
+ modal.value.close()
159
+ }
160
+
161
+ defineExpose({
162
+ open
163
+ })
164
+
165
+ </script>
166
+
167
+ <style module>
168
+
169
+ .comp{
170
+
171
+ }
172
+
173
+ </style>
@@ -79,7 +79,7 @@ export default{
79
79
  }
80
80
 
81
81
  .container{
82
- @apply flex flex-col divide-y divide-text-50;
82
+ @apply flex flex-col divide-y divide-border-50;
83
83
  }
84
84
 
85
85
  </style>
@@ -131,12 +131,12 @@ export default{
131
131
  }
132
132
 
133
133
  .comp button{
134
- @apply border-[1px] border-text-200 bg-text-100 rounded-lg p-1 px-3;
134
+ @apply border-[1px] border-border-200 bg-text-100 rounded-lg p-1 px-3;
135
135
  }
136
136
 
137
137
  .comp select{
138
138
  @apply appearance-none outline-none p-1 px-2 bg-transparent cursor-pointer w-full;
139
- @apply border-[1px] border-text-200 rounded-lg;
139
+ @apply border-[1px] border-border-200 rounded-lg;
140
140
  }
141
141
 
142
142
  </style>
@@ -42,7 +42,7 @@
42
42
  type="button"
43
43
  @click="instance.icon = svg"
44
44
  class="border-[1px] rounded-lg flex items-center justify-center p-4 bg-base-500"
45
- :class="instance.icon === svg ? 'border-primary' : 'border-text-200'"
45
+ :class="instance.icon === svg ? 'border-primary' : 'border-border-200'"
46
46
  v-html="$util.addHTMLAttribute(svg, { width:21, height:21, class:'fill-text-500' })">
47
47
  </button>
48
48
  <button v-if="isCustomIcon"
@@ -0,0 +1,78 @@
1
+ <template>
2
+ <div :class="$style.comp">
3
+
4
+ <div class="p-6 px-4 flex flex-col gap-4">
5
+
6
+ <div>
7
+ <div class="flex flex-row gap-2 items-center">
8
+ <small class="flex-1 text-text-400">Menu</small>
9
+ <button type="button"
10
+ class="text-primary text-sm"
11
+ @click="$refs.modal.open({}, item => menu.push(item))">
12
+ Add Menu
13
+ </button>
14
+ </div>
15
+
16
+ <TreeView class="mt-2"
17
+ v-model="menu"
18
+ @add="(items) => openComponentSelector({ callback:(component) => items.push(component) })"
19
+ @duplicate="duplicate">
20
+ <template #default="{ item }">
21
+ <div class="flex-1 text-ellipsis whitespace-nowrap overflow-hidden"
22
+ @click="$refs.modal.open(item, updatedItem => Object.assign(item, updatedItem))">
23
+ {{ item.text }}
24
+ </div>
25
+ </template>
26
+ </TreeView>
27
+ </div>
28
+
29
+ </div>
30
+
31
+ <ComponentSetting2 :item="item"
32
+ :view-type="viewType"
33
+ :view-types="viewTypes"
34
+ :view-index="viewIndex"
35
+ defaultDisplay="block"
36
+ @change="$emit('change')" />
37
+
38
+ <LinkSettingModal ref="modal" />
39
+
40
+ </div>
41
+ </template>
42
+
43
+ <script setup>
44
+
45
+ import {computed, inject} from "vue";
46
+ import LinkSettingModal from "./LinkSettingModal.vue";
47
+
48
+ const { item } = defineProps({
49
+ item: {
50
+ type: Object,
51
+ required: true
52
+ },
53
+
54
+ viewType: String,
55
+
56
+ viewIndex: Number,
57
+
58
+ viewTypes: Array,
59
+ })
60
+
61
+ const duplicate = inject('duplicate')
62
+ const openComponentSelector = inject('openComponentSelector')
63
+
64
+ const menu = computed(() => {
65
+ if(!Array.isArray(item.props.menu))
66
+ item.props.menu = []
67
+ return item.props.menu
68
+ })
69
+
70
+ </script>
71
+
72
+ <style module>
73
+
74
+ .comp {
75
+ @apply flex flex-col divide-y divide-border-50;
76
+ }
77
+
78
+ </style>
@@ -1,54 +1,47 @@
1
1
  <template>
2
2
  <div :class="$style.comp">
3
3
 
4
- <div class="flex flex-col gap-4">
4
+ <div class="p-6 py-4">
5
+
6
+ <div class="flex flex-col">
7
+ <small class="text-text-400">Open</small>
8
+ <Switch v-model="item.props.debugState" />
9
+ </div>
10
+
11
+ </div>
12
+
13
+ <div class="p-6 py-4 flex flex-col gap-4">
14
+
5
15
  <div>
6
- <strong class="flex-1 text-text-400">Modal</strong>
7
- <div class="h-[1px] bg-text-100 mt-2"></div>
16
+ <small class="text-text-400">Hash</small>
17
+ <Textbox v-model="item.props.hash" placeholder="With hash # prefix" />
8
18
  </div>
9
19
 
10
- <div class="grid grid-cols-2 gap-4">
11
-
12
- <div class="col-span-2 flex flex-row items-center">
13
- <label :class="$style.label" class="flex-1">Hash</label>
14
- <div class="flex flex-row items-center gap-1">
15
- <Textbox v-model="item.props.hash" class="w-[150px]" placeholder="With hash # prefix"/>
16
- </div>
17
- </div>
18
-
19
- <div class="col-span-2 flex flex-row items-center">
20
- <label :class="$style.label" class="flex-1">Position</label>
21
- <div class="flex flex-row items-center gap-1">
22
- <Dropdown v-model="item.props.dock">
23
- <option disabled selected>Choose Position</option>
24
- <option value="center">Center</option>
25
- <option value="top">Top</option>
26
- <option value="bottom">Bottom</option>
27
- <option value="left">Left</option>
28
- <option value="right">Right</option>
29
- </Dropdown>
30
- </div>
31
- </div>
32
-
33
- <div class="col-span-2 flex flex-row items-center">
34
- <label :class="$style.label" class="flex-1">Dismissable</label>
35
- <Checkbox v-model="item.props.dismissable" />
36
- </div>
37
-
38
- <div class="col-span-2 flex flex-row items-center">
39
- <label :class="$style.label" class="flex-1">Debug</label>
40
- <Switch v-model="item.props.debugState" />
41
- </div>
20
+ <div>
21
+ <small class="text-text-400">Position</small>
22
+ <Dropdown v-model="item.props.dock">
23
+ <option disabled selected>Choose Position</option>
24
+ <option value="center">Center</option>
25
+ <option value="top">Top</option>
26
+ <option value="bottom">Bottom</option>
27
+ <option value="left">Left</option>
28
+ <option value="right">Right</option>
29
+ </Dropdown>
30
+ </div>
42
31
 
32
+ <div>
33
+ <small class="text-text-400">Dismissable</small>
34
+ <Checkbox v-model="item.props.dismissable" />
43
35
  </div>
44
36
 
45
37
  </div>
46
38
 
47
- <ComponentSetting2 :item="item"
48
- :view-type="viewType"
49
- :view-types="viewTypes"
50
- default-display="block"
51
- @change="$emit('change')" />
39
+ <ComponentSetting2 :item="item"
40
+ :view-type="viewType"
41
+ :view-types="viewTypes"
42
+ :view-index="viewIndex"
43
+ defaultDisplay="block"
44
+ @change="$emit('change')" />
52
45
  </div>
53
46
  </template>
54
47
 
@@ -71,11 +64,16 @@ export default{
71
64
 
72
65
  props: {
73
66
 
74
- item: Object,
67
+ item: {
68
+ type: Object,
69
+ required: true
70
+ },
71
+
72
+ viewType: String,
75
73
 
76
- viewTypes: Array,
74
+ viewIndex: Number,
77
75
 
78
- viewType: String
76
+ viewTypes: Array,
79
77
 
80
78
  },
81
79
 
@@ -90,7 +88,7 @@ export default{
90
88
  <style module>
91
89
 
92
90
  .comp{
93
- @apply flex flex-col gap-6;
91
+ @apply flex flex-col divide-y divide-border-50;
94
92
  }
95
93
 
96
94
  </style>
@@ -110,12 +110,12 @@ export default{
110
110
  }
111
111
 
112
112
  .comp button{
113
- @apply border-[1px] border-text-200 bg-text-100 rounded-lg p-1 px-3;
113
+ @apply border-[1px] border-border-200 bg-text-100 rounded-lg p-1 px-3;
114
114
  }
115
115
 
116
116
  .comp select{
117
117
  @apply appearance-none outline-none p-1 px-2 bg-transparent cursor-pointer w-full;
118
- @apply border-[1px] border-text-200 rounded-lg;
118
+ @apply border-[1px] border-border-200 rounded-lg;
119
119
  }
120
120
 
121
121
  </style>
@@ -1,26 +1,34 @@
1
1
  <template>
2
2
  <div :class="$style.comp">
3
3
 
4
+ <small class="text-text-400">
5
+ {{ text }}
6
+ </small>
7
+
4
8
  <div class="flex flex-row gap-1">
5
- <button v-for="_type in types" type="button" @click="setType(_type)">
6
- <slot :name="`icon${_type}`">
7
- <svg v-if="_type === 1" width="12" height="12" :class="_type === type ? 'fill-primary-500' : 'fill-text'" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path d="M400 32H48C21.5 32 0 53.5 0 80v352c0 26.5 21.5 48 48 48h352c26.5 0 48-21.5 48-48V80c0-26.5-21.5-48-48-48zm16 400c0 8.8-7.2 16-16 16H48c-8.8 0-16-7.2-16-16V80c0-8.8 7.2-16 16-16h352c8.8 0 16 7.2 16 16v352z"/></svg>
8
- <svg v-else-if="_type === 2" width="12" height="12" :class="_type === type ? 'fill-primary-500' : 'fill-text'" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path d="M120 32H48A48 48 0 0 0 0 80v352a48 48 0 0 0 48 48h72a8 8 0 0 0 8-8v-16a8 8 0 0 0-8-8H48a16 16 0 0 1-16-16V80a16 16 0 0 1 16-16h72a8 8 0 0 0 8-8V40a8 8 0 0 0-8-8zm280 0h-72a8 8 0 0 0-8 8v16a8 8 0 0 0 8 8h72a16 16 0 0 1 16 16v352a16 16 0 0 1-16 16h-72a8 8 0 0 0-8 8v16a8 8 0 0 0 8 8h72a48 48 0 0 0 48-48V80a48 48 0 0 0-48-48z"/></svg>
9
- <svg v-else-if="_type === 4" width="12" height="12" :class="_type === type ? 'fill-primary-500' : 'fill-text'" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path d="M0 80v352c0 26.51 21.49 48 48 48h416c26.51 0 48-21.49 48-48V80c0-26.51-21.49-48-48-48H48C21.49 32 0 53.49 0 80zm240-16v176H32V80c0-8.837 7.163-16 16-16h192zM32 432V272h208v176H48c-8.837 0-16-7.163-16-16zm240 16V272h208v160c0 8.837-7.163 16-16 16H272zm208-208H272V64h192c8.837 0 16 7.163 16 16v160z"/></svg>
10
- </slot>
11
- </button>
9
+ <Radio v-for="(_, index) in keys.length"
10
+ :custom="true"
11
+ :value="index"
12
+ v-model.number="type" @change="resetValue">
13
+ <button type="button">
14
+ <svg v-if="index === 0" width="12" height="12" :class="index === type ? 'fill-primary-500' : 'fill-text'" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path d="M400 32H48C21.5 32 0 53.5 0 80v352c0 26.5 21.5 48 48 48h352c26.5 0 48-21.5 48-48V80c0-26.5-21.5-48-48-48zm16 400c0 8.8-7.2 16-16 16H48c-8.8 0-16-7.2-16-16V80c0-8.8 7.2-16 16-16h352c8.8 0 16 7.2 16 16v352z"/></svg>
15
+ <svg v-else-if="index === 1" width="12" height="12" :class="index === type ? 'fill-primary-500' : 'fill-text'" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path d="M120 32H48A48 48 0 0 0 0 80v352a48 48 0 0 0 48 48h72a8 8 0 0 0 8-8v-16a8 8 0 0 0-8-8H48a16 16 0 0 1-16-16V80a16 16 0 0 1 16-16h72a8 8 0 0 0 8-8V40a8 8 0 0 0-8-8zm280 0h-72a8 8 0 0 0-8 8v16a8 8 0 0 0 8 8h72a16 16 0 0 1 16 16v352a16 16 0 0 1-16 16h-72a8 8 0 0 0-8 8v16a8 8 0 0 0 8 8h72a48 48 0 0 0 48-48V80a48 48 0 0 0-48-48z"/></svg>
16
+ <svg v-else-if="index === 2" width="12" height="12" :class="index === type ? 'fill-primary-500' : 'fill-text'" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path d="M0 80v352c0 26.51 21.49 48 48 48h416c26.51 0 48-21.49 48-48V80c0-26.51-21.49-48-48-48H48C21.49 32 0 53.49 0 80zm240-16v176H32V80c0-8.837 7.163-16 16-16h192zM32 432V272h208v176H48c-8.837 0-16-7.163-16-16zm240 16V272h208v160c0 8.837-7.163 16-16 16H272zm208-208H272V64h192c8.837 0 16 7.163 16 16v160z"/></svg>
17
+ </button>
18
+ </Radio>
12
19
  </div>
13
20
 
14
- <div class="grid gap-1 mt-1" :class="`grid-cols-${type}`">
15
- <select v-for="(__, _index) in type" @change="setValue()"
16
- :ref="`value`"
17
- :value="`${value[_index]}`" class="max-w-[100px]">
18
- <option value="">-</option>
19
- <option v-for="_value in values"
20
- :value="Array.isArray(_value) ? `${keys[index][_index]}${_value[0]}` : `${keys[index][_index]}${_value}`">
21
- {{ `${Array.isArray(_value) ? _value[1] : _value}` }}
22
- </option>
23
- </select>
21
+ <div class="grid gap-1 mt-1" :class="`grid-cols-${gridCols[type]}`">
22
+ <div v-for="(_key, _index) in keys[type]">
23
+ <small class="text-text-400">{{ texts[type][_index] }}</small>
24
+ <select v-model="value[_index]">
25
+ <option value="">-</option>
26
+ <option v-for="_value in values"
27
+ :value="`${viewType}${_key}${Array.isArray(_value) ? _value[0] : _value}`">
28
+ {{ Array.isArray(_value) ? _value[1] : _value }}
29
+ </option>
30
+ </select>
31
+ </div>
24
32
  </div>
25
33
 
26
34
  </div>
@@ -30,11 +38,18 @@
30
38
 
31
39
  export default{
32
40
 
33
- emits: [ 'change', 'update:modelValue' ],
41
+ emits: [ 'change' ],
34
42
 
35
43
  props: {
36
44
 
37
- modelValue: String,
45
+ name: String,
46
+
47
+ text: String,
48
+
49
+ item: {
50
+ type: Object,
51
+ required: true
52
+ },
38
53
 
39
54
  keys: {
40
55
  type: Array,
@@ -47,47 +62,65 @@ export default{
47
62
 
48
63
  values: {
49
64
  type: Array,
50
- default: [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 ]
65
+ default: [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 'auto' ]
51
66
  },
52
67
 
68
+ viewType: String,
69
+
70
+ viewIndex: Number,
71
+
72
+ viewTypes: Array,
73
+
53
74
  },
54
75
 
55
- methods: {
76
+ data(){
77
+ return {
78
+ value: [],
79
+ type: 0,
80
+ gridCols: {
81
+ 0: 1,
82
+ 1: 2,
83
+ 2: 4
84
+ },
85
+ texts: {
86
+ 0: [ 'All' ],
87
+ 1: [ 'X', 'Y' ],
88
+ 2: [ 'Left', 'Top', 'Right', 'Bottom' ]
89
+ }
90
+ }
91
+ },
56
92
 
57
- setType(type){
58
- let val = []
59
- for(let i = 0; i < type - 1; i++)
60
- val.push(' ')
93
+ methods: {
61
94
 
62
- this.$emit('update:modelValue', val.join(''))
95
+ resetValue(){
96
+ const value = []
97
+ for(let i = 0 ; i < this.gridCols[this.type] ; i++)
98
+ value.push('')
99
+ this.value = value
63
100
  },
64
101
 
65
102
  setValue(){
66
- this.$emit('update:modelValue', this.$refs.value.map(_ => _.value).join(' '))
103
+ this.value = (this.item.props[this.name][this.viewIndex] ?? '').split(' ')
104
+ this.type = Object.values(this.gridCols).indexOf(this.value.length)
67
105
  }
68
106
 
69
107
  },
70
108
 
71
- computed: {
72
-
73
- viewIndex(){
74
- return this.viewTypes.findIndex(_ => _.value === this.viewType)
75
- },
76
-
77
- types(){
78
- return (this.keys ?? []).map(_ => _.length)
79
- },
109
+ mounted() {
110
+ this.setValue()
111
+ },
80
112
 
81
- type(){
82
- return this.value.length
83
- },
113
+ watch: {
84
114
 
85
- index(){
86
- return this.keys.findIndex(_ => _.length === this.type)
115
+ value: {
116
+ deep: true,
117
+ handler(){
118
+ this.item.props[this.name][this.viewIndex] = this.value.join(' ')
119
+ }
87
120
  },
88
121
 
89
- value(){
90
- return (this.modelValue ?? '').split(' ')
122
+ viewIndex(){
123
+ this.setValue()
91
124
  }
92
125
 
93
126
  }
@@ -103,12 +136,12 @@ export default{
103
136
  }
104
137
 
105
138
  .comp button{
106
- @apply border-[1px] border-text-200 bg-text-100 rounded-lg p-1 px-3;
139
+ @apply border-[1px] border-border-200 bg-text-100 rounded-lg p-1 px-3;
107
140
  }
108
141
 
109
142
  .comp select{
110
143
  @apply appearance-none outline-none p-1 px-2 bg-transparent cursor-pointer w-full;
111
- @apply border-[1px] border-text-200 rounded-lg;
144
+ @apply border-[1px] border-border-200 rounded-lg;
112
145
  }
113
146
 
114
147
  </style>