@mixd-id/web-scaffold 0.1.2301231369 → 0.2.240702

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 (249) hide show
  1. package/LICENSE +1 -0
  2. package/docs/components/Header2.md +16 -0
  3. package/docs/components/TreeView.md +0 -0
  4. package/package.json +22 -5
  5. package/src/App.vue +9 -1
  6. package/src/components/Ahref.vue +175 -9
  7. package/src/components/Alert.vue +181 -75
  8. package/src/components/Article.vue +393 -0
  9. package/src/components/Block.vue +31 -0
  10. package/src/components/Box.vue +34 -0
  11. package/src/components/Button.vue +208 -129
  12. package/src/components/Carousel.vue +194 -124
  13. package/src/components/Chart.vue +485 -0
  14. package/src/components/ChartBar.vue +193 -0
  15. package/src/components/Checkbox.vue +95 -55
  16. package/src/components/CodeEditor.vue +61 -0
  17. package/src/components/ColorPicker.vue +158 -0
  18. package/src/components/ColorPicker2.vue +164 -0
  19. package/src/components/Confirm.vue +178 -0
  20. package/src/components/ContextMenu.vue +164 -76
  21. package/src/components/ConversationBuilder.vue +161 -0
  22. package/src/components/CopyToClipboard.vue +6 -31
  23. package/src/components/Countdown.vue +104 -53
  24. package/src/components/DGrid.vue +21 -0
  25. package/src/components/DGridItem.vue +263 -0
  26. package/src/components/DataList.vue +92 -0
  27. package/src/components/Datepicker.vue +65 -41
  28. package/src/components/DayTimeRange.vue +125 -0
  29. package/src/components/Dropdown.vue +32 -9
  30. package/src/components/ErrorText.vue +30 -9
  31. package/src/components/FBLogin.vue +194 -0
  32. package/src/components/Flex.vue +70 -0
  33. package/src/components/GSignIn.vue +166 -0
  34. package/src/components/Gmaps.vue +35 -11
  35. package/src/components/Grid.vue +24 -20
  36. package/src/components/HTMLEditor.vue +258 -79
  37. package/src/components/IconMenu.vue +95 -0
  38. package/src/components/IconMenu2.vue +89 -0
  39. package/src/components/IconPlus.vue +89 -0
  40. package/src/components/Image.vue +161 -59
  41. package/src/components/Image360.vue +2 -2
  42. package/src/components/ImagePreview.vue +23 -11
  43. package/src/components/ImportModal.vue +27 -14
  44. package/src/components/Link.vue +39 -0
  45. package/src/components/List.vue +1177 -0
  46. package/src/components/ListItem.vue +32 -21
  47. package/src/components/ListPage1.vue +88 -17
  48. package/src/components/ListPage1Filter.vue +2 -2
  49. package/src/components/ListView.vue +962 -0
  50. package/src/components/ListViewBarSummary.vue +81 -0
  51. package/src/components/ListViewLineSummary.vue +75 -0
  52. package/src/components/ListViewLiveBarSummary.vue +52 -0
  53. package/src/components/ListViewMapSummary.vue +56 -0
  54. package/src/components/ListViewSettings.vue +514 -0
  55. package/src/components/ListViewTableSummary.vue +77 -0
  56. package/src/components/LogViewerItem.vue +116 -0
  57. package/src/components/Modal.vue +274 -122
  58. package/src/components/MultilineText.vue +177 -0
  59. package/src/components/OTPField.vue +5 -6
  60. package/src/components/ObjectTree.vue +105 -0
  61. package/src/components/PageBuilder.vue +449 -0
  62. package/src/components/Paragraph.vue +41 -0
  63. package/src/components/PresetSelectorFilterItem.vue +178 -0
  64. package/src/components/Radio.vue +62 -87
  65. package/src/components/SearchButton.vue +1 -1
  66. package/src/components/Slider.vue +107 -75
  67. package/src/components/Svg.vue +33 -0
  68. package/src/components/Switch.vue +15 -5
  69. package/src/components/TabView.vue +0 -1
  70. package/src/components/Table.vue +56 -0
  71. package/src/components/TableViewHead.vue +2 -2
  72. package/src/components/Tabs.vue +68 -11
  73. package/src/components/Test.vue +23 -0
  74. package/src/components/Testimonial.vue +86 -0
  75. package/src/components/Text.vue +49 -0
  76. package/src/components/TextBlock.vue +50 -0
  77. package/src/components/TextWithTag.vue +225 -0
  78. package/src/components/Textarea.vue +22 -16
  79. package/src/components/Textbox.vue +83 -62
  80. package/src/components/Thumbnail.vue +27 -0
  81. package/src/components/Timepicker.vue +15 -8
  82. package/src/components/Toast.vue +60 -38
  83. package/src/components/TreeView.vue +101 -0
  84. package/src/components/TreeViewItem.vue +424 -0
  85. package/src/components/TreeViewItem1.vue +282 -0
  86. package/src/components/VirtualGrid.vue +284 -0
  87. package/src/components/VirtualScroll.vue +88 -21
  88. package/src/components/VirtualTable.vue +277 -71
  89. package/src/components/YoutubeVideo.vue +196 -0
  90. package/src/configs/icons-fa.json +12 -0
  91. package/src/events/event.js +2 -0
  92. package/src/index.js +477 -53
  93. package/src/main.js +0 -9
  94. package/src/middleware/http/trim-string.js +20 -0
  95. package/src/mixin/component.js +222 -0
  96. package/src/mixin/website.js +121 -0
  97. package/src/stores/components.js +36 -0
  98. package/src/themes/default/index.js +178 -34
  99. package/src/utils/helpers.js +378 -7
  100. package/src/utils/helpers.mjs +274 -16
  101. package/src/utils/importer.js +60 -26
  102. package/src/utils/listpage1.js +403 -267
  103. package/src/utils/listview.js +1287 -0
  104. package/src/utils/preset-selector.js +1055 -0
  105. package/src/utils/preset-selector.mjs +185 -0
  106. package/src/utils/selection.js +15 -36
  107. package/src/utils/web.js +50 -0
  108. package/src/utils/wss.js +294 -0
  109. package/src/utils/wss.mjs +280 -0
  110. package/src/widgets/AhrefSetting.vue +94 -0
  111. package/src/widgets/ArticleSetting.vue +469 -0
  112. package/src/widgets/BackgroundSetting.vue +132 -0
  113. package/src/widgets/BlockSetting.vue +49 -0
  114. package/src/widgets/BorderSetting.vue +201 -0
  115. package/src/widgets/BoxSetting.vue +53 -0
  116. package/src/widgets/ButtonSetting.vue +114 -0
  117. package/src/widgets/CarouselSetting.vue +193 -0
  118. package/src/widgets/ColumnSelector.vue +80 -0
  119. package/src/widgets/ComponentPropertyLabel.vue +35 -0
  120. package/src/widgets/ComponentPropertySelector.vue +115 -0
  121. package/src/widgets/ComponentSetting.vue +2220 -0
  122. package/src/widgets/ComponentSetting2.vue +1018 -0
  123. package/src/widgets/ComponentSetting3.vue +231 -0
  124. package/src/widgets/ContactForm.vue +193 -0
  125. package/src/widgets/ContactFormSetting.vue +384 -0
  126. package/src/widgets/CountdownSetting.vue +76 -0
  127. package/src/widgets/DataListSetting.vue +102 -0
  128. package/src/widgets/EffectSetting.vue +94 -0
  129. package/src/widgets/EmbeddedVideo.vue +60 -0
  130. package/src/widgets/EmbeddedVideoSetting.vue +48 -0
  131. package/src/widgets/FAQ.vue +85 -0
  132. package/src/widgets/FAQSetting.vue +88 -0
  133. package/src/widgets/FeatureList.vue +128 -0
  134. package/src/widgets/FeatureListSetting.vue +223 -0
  135. package/src/widgets/FiltersSetting.vue +88 -0
  136. package/src/widgets/FlexSetting.vue +197 -0
  137. package/src/widgets/GridSetting.vue +290 -0
  138. package/src/widgets/Header.vue +15 -0
  139. package/src/widgets/Header1.vue +41 -0
  140. package/src/widgets/Header1Setting.vue +75 -0
  141. package/src/widgets/Header2.vue +102 -0
  142. package/src/widgets/Header2Setting.vue +277 -0
  143. package/src/widgets/HeaderSetting.vue +104 -0
  144. package/src/widgets/IconList.vue +51 -0
  145. package/src/widgets/IconListSetting.vue +184 -0
  146. package/src/widgets/ImageSetting.vue +146 -0
  147. package/src/widgets/LayoutSetting.vue +251 -0
  148. package/src/widgets/LinkSetting.vue +186 -0
  149. package/src/widgets/LogViewer.vue +85 -0
  150. package/src/widgets/MarginPaddingSetting.vue +58 -0
  151. package/src/widgets/MarginSetting.vue +142 -0
  152. package/src/widgets/MenuEditor.vue +256 -0
  153. package/src/widgets/MobileMenu.vue +182 -0
  154. package/src/widgets/ModalSetting.vue +96 -0
  155. package/src/widgets/MultiValueSetting.vue +121 -0
  156. package/src/widgets/MultiValueSetting2.vue +114 -0
  157. package/src/widgets/PaddingSetting.vue +142 -0
  158. package/src/widgets/ParagraphSetting.vue +86 -0
  159. package/src/widgets/PresetBar.vue +880 -0
  160. package/src/widgets/PresetBarPivotColumnEdit.vue +197 -0
  161. package/src/widgets/PresetSelector.vue +673 -0
  162. package/src/widgets/Review.vue +131 -0
  163. package/src/widgets/ReviewSetting.vue +201 -0
  164. package/src/widgets/Share.vue +165 -0
  165. package/src/widgets/ShareSetting.vue +92 -0
  166. package/src/widgets/SizingSetting.vue +306 -0
  167. package/src/widgets/SpacingSetting.vue +77 -0
  168. package/src/widgets/StyleSetting.vue +328 -0
  169. package/src/widgets/StyleSetting2.vue +90 -0
  170. package/src/widgets/SvgSetting.vue +133 -0
  171. package/src/widgets/TableSetting.vue +172 -0
  172. package/src/widgets/TestimonialSetting.vue +152 -0
  173. package/src/widgets/TextBlockSetting.vue +78 -0
  174. package/src/widgets/ThumbnailSetting.vue +49 -0
  175. package/src/widgets/TransitionSetting.vue +64 -0
  176. package/src/widgets/TypographySetting.vue +334 -0
  177. package/src/widgets/UserActionBuilder/UserActionItem.vue +165 -0
  178. package/src/widgets/UserActionBuilder/UserActionOutput.vue +126 -0
  179. package/src/widgets/UserActionBuilder.vue +457 -0
  180. package/src/widgets/WebComponentSelector.vue +201 -0
  181. package/src/widgets/WebDatasourceSelector.vue +153 -0
  182. package/src/widgets/WebLayoutSelector.vue +376 -0
  183. package/src/widgets/WebPageBuilder.vue +1849 -0
  184. package/src/widgets/WebPageBuilder2.vue +1091 -0
  185. package/src/widgets/WebPageBuilder3.vue +411 -0
  186. package/src/widgets/WebPageBuilder4/ActionSetting.vue +158 -0
  187. package/src/widgets/WebPageBuilder4/BackgroundColorSetting.vue +54 -0
  188. package/src/widgets/WebPageBuilder4/BackgroundPositionSetting.vue +75 -0
  189. package/src/widgets/WebPageBuilder4/BackgroundRepeatSetting.vue +72 -0
  190. package/src/widgets/WebPageBuilder4/BackgroundSizeSetting.vue +72 -0
  191. package/src/widgets/WebPageBuilder4/BlurSetting.vue +72 -0
  192. package/src/widgets/WebPageBuilder4/BorderColorSetting.vue +64 -0
  193. package/src/widgets/WebPageBuilder4/BorderRadiusSetting.vue +75 -0
  194. package/src/widgets/WebPageBuilder4/BorderSizeSetting.vue +69 -0
  195. package/src/widgets/WebPageBuilder4/BorderStyleSetting.vue +72 -0
  196. package/src/widgets/WebPageBuilder4/BoxShadowSetting.vue +73 -0
  197. package/src/widgets/WebPageBuilder4/ButtonSetting.vue +73 -0
  198. package/src/widgets/WebPageBuilder4/CarouselSetting.vue +122 -0
  199. package/src/widgets/WebPageBuilder4/ColorSetting.vue +63 -0
  200. package/src/widgets/WebPageBuilder4/DataSetting.vue +92 -0
  201. package/src/widgets/WebPageBuilder4/DisplaySetting.vue +76 -0
  202. package/src/widgets/WebPageBuilder4/FlexAlignSetting.vue +71 -0
  203. package/src/widgets/WebPageBuilder4/FlexDirectionSetting.vue +70 -0
  204. package/src/widgets/WebPageBuilder4/FlexJustifySetting.vue +74 -0
  205. package/src/widgets/WebPageBuilder4/FlexPropertySetting.vue +71 -0
  206. package/src/widgets/WebPageBuilder4/FlexSetting.vue +105 -0
  207. package/src/widgets/WebPageBuilder4/FlexWrapSetting.vue +69 -0
  208. package/src/widgets/WebPageBuilder4/FontSizeSetting.vue +76 -0
  209. package/src/widgets/WebPageBuilder4/GapSetting.vue +75 -0
  210. package/src/widgets/WebPageBuilder4/GrayscaleSetting.vue +68 -0
  211. package/src/widgets/WebPageBuilder4/GridSetting.vue +166 -0
  212. package/src/widgets/WebPageBuilder4/HeightSetting.vue +95 -0
  213. package/src/widgets/WebPageBuilder4/ImageSetting.vue +102 -0
  214. package/src/widgets/WebPageBuilder4/LinkSetting.vue +68 -0
  215. package/src/widgets/WebPageBuilder4/MarginSetting.vue +70 -0
  216. package/src/widgets/WebPageBuilder4/MaxHeightSetting.vue +82 -0
  217. package/src/widgets/WebPageBuilder4/MaxWidthSetting.vue +90 -0
  218. package/src/widgets/WebPageBuilder4/MinHeightSetting.vue +81 -0
  219. package/src/widgets/WebPageBuilder4/MinWidthSetting.vue +101 -0
  220. package/src/widgets/WebPageBuilder4/MobileMenuSetting.vue +106 -0
  221. package/src/widgets/WebPageBuilder4/MultiValueSetting.vue +155 -0
  222. package/src/widgets/WebPageBuilder4/OpacitySetting.vue +77 -0
  223. package/src/widgets/WebPageBuilder4/OverflowSetting.vue +81 -0
  224. package/src/widgets/WebPageBuilder4/PaddingSetting.vue +53 -0
  225. package/src/widgets/WebPageBuilder4/PositionSetting.vue +191 -0
  226. package/src/widgets/WebPageBuilder4/PropertySetting.vue +183 -0
  227. package/src/widgets/WebPageBuilder4/Setting.vue +73 -0
  228. package/src/widgets/WebPageBuilder4/StyleSetting.vue +77 -0
  229. package/src/widgets/WebPageBuilder4/SvgSetting.vue +207 -0
  230. package/src/widgets/WebPageBuilder4/TextSetting.vue +72 -0
  231. package/src/widgets/WebPageBuilder4/TextTransformSetting.vue +70 -0
  232. package/src/widgets/WebPageBuilder4/TreeView.vue +43 -0
  233. package/src/widgets/WebPageBuilder4/TreeViewItem.vue +329 -0
  234. package/src/widgets/WebPageBuilder4/WebPageComponentSelector.vue +147 -0
  235. package/src/widgets/WebPageBuilder4/WebPageDataEdit.vue +121 -0
  236. package/src/widgets/WebPageBuilder4/WebPagePropertySelector.vue +172 -0
  237. package/src/widgets/WebPageBuilder4/WidthSetting.vue +105 -0
  238. package/src/widgets/WebPageBuilder4/ZIndexSetting.vue +72 -0
  239. package/src/widgets/WebPageBuilder4.vue +1084 -0
  240. package/src/widgets/WebPagePreview.vue +295 -0
  241. package/src/widgets/WebPageSelector.vue +173 -0
  242. package/src/widgets/WebTemplateCreator.vue +156 -0
  243. package/src/widgets/YoutubeVideoSetting.vue +65 -0
  244. package/tailwind.config.js +513 -0
  245. package/test.json +22 -0
  246. package/public/images/mixd-logo2.png +0 -0
  247. package/src/components/ButtonGroup.vue +0 -101
  248. package/src/components/DynamicTemplate.vue +0 -44
  249. package/src/components/GridColumn.vue +0 -31
@@ -0,0 +1,178 @@
1
+ <template>
2
+ <Teleport to=".YWxl">
3
+ <Transition name="confirm-outer">
4
+ <div v-if="isOpen" :class="$style.confirm" ref="confirm">
5
+ <Transition name="confirm" @after-appear="onAfterAppear" appear>
6
+ <div :class="$style.cont1">
7
+
8
+ <slot v-if="$slots['icon']" name="icon"></slot>
9
+ <svg width="100" height="100" class="fill-text-300" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
10
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M12 13.75C12.4142 13.75 12.75 13.4142 12.75 13V8.00001C12.75 7.5858 12.4142 7.25001 12 7.25001C11.5858 7.25001 11.25 7.5858 11.25 8.00001V13C11.25 13.4142 11.5858 13.75 12 13.75Z"/>
11
+ <path d="M13 16C13 16.5523 12.5523 17 12 17C11.4477 17 11 16.5523 11 16C11 15.4477 11.4477 15 12 15C12.5523 15 13 15.4477 13 16Z"/>
12
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M12 20.5C16.6944 20.5 20.5 16.6944 20.5 12C20.5 7.30558 16.6944 3.5 12 3.5C7.30558 3.5 3.5 7.30558 3.5 12C3.5 16.6944 7.30558 20.5 12 20.5ZM12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22Z"/>
13
+ </svg>
14
+
15
+ <div :class="$style.cont2">
16
+ <h5 :class="$style.title">{{ title }}</h5>
17
+ <p :class="$style.description">{{ message }}</p>
18
+ </div>
19
+
20
+ <div class="mt-4 flex flex-row gap-2">
21
+ <Button ref="btnOK" @click="onConfirm" class="min-w-[88px]" tabindex="0">
22
+ <strong class="px-4">
23
+ {{ buttonText[0] }}
24
+ </strong>
25
+ </Button>
26
+ <Button variant="minimal" @click="onDismiss" class="min-w-[88px] px-4 hover:text-primary">
27
+ {{ buttonText[1] }}
28
+ </Button>
29
+ </div>
30
+
31
+ </div>
32
+ </Transition>
33
+ </div>
34
+ </Transition>
35
+ </Teleport>
36
+ </template>
37
+
38
+ <script>
39
+
40
+ export default{
41
+
42
+ methods: {
43
+
44
+ /**
45
+ * @param {object} obj - The confirm object
46
+ * @param {string} [obj.title] - The title of the confirm
47
+ * @param {string} obj.message - The message of the confirm
48
+ * @param {string[]} [obj.buttonText] - The text of the buttons
49
+ * @param {function} [obj.onConfirm] - The callback function when the confirm button is clicked
50
+ * @param {function} [obj.onDismiss] - The callback function when the dismiss button is clicked
51
+ */
52
+ open(obj){
53
+ this.confirm = obj
54
+ this.isOpen = true
55
+ },
56
+
57
+ close(){
58
+ this.isOpen = false
59
+ },
60
+
61
+ onAfterAppear(){
62
+ this.$refs.btnOK.focus()
63
+ this.$emit('appear')
64
+ },
65
+
66
+ onConfirm(){
67
+ if(typeof this.confirm.onConfirm === 'function'){
68
+ this.confirm.onConfirm()
69
+ }
70
+ this.close()
71
+ },
72
+
73
+ onDismiss(){
74
+ if(typeof this.confirm.onDismiss === 'function'){
75
+ this.confirm.onDismiss()
76
+ }
77
+ this.close()
78
+ },
79
+
80
+ },
81
+
82
+ computed: {
83
+
84
+ buttonText(){
85
+ return Array.isArray(this.confirm.buttonText) && this.confirm.buttonText.length === 2 ?
86
+ this.confirm.buttonText :
87
+ [ 'OK', 'Cancel' ]
88
+ },
89
+
90
+ title(){
91
+ return this.confirm.title ?? this.$t('Confirm')
92
+ },
93
+
94
+ message(){
95
+ return this.confirm.message ?? ''
96
+ },
97
+
98
+ },
99
+
100
+ data(){
101
+ return {
102
+ confirm: {},
103
+ isOpen: false
104
+ }
105
+ }
106
+
107
+ }
108
+
109
+ </script>
110
+
111
+ <style module>
112
+
113
+ .confirm{
114
+ @apply fixed top-0 left-0 flex w-screen h-screen px-8;
115
+ @apply items-center justify-center bg-white/50 backdrop-blur-md;
116
+ z-index: 60;
117
+ }
118
+ [data-theme="dark"] .confirm{
119
+ @apply bg-black/50;
120
+ }
121
+
122
+ .confirm>*{
123
+ @apply max-h-[60vh] overflow-y-auto bg-base-500 rounded-xl;
124
+ @apply border-[1px] border-text-50;
125
+ @apply min-w-[280px] max-w-[80vw] md:max-w-[480px];
126
+ }
127
+
128
+ .cont1{
129
+ @apply p-4 flex flex-col items-center leading-6;
130
+ }
131
+
132
+ .cont2{
133
+ @apply my-4 text-center flex-1 overflow-y-auto;
134
+ }
135
+
136
+ .title{
137
+ @apply my-1 break-words whitespace-pre-line;
138
+ }
139
+
140
+ .description{
141
+ @apply overflow-y-auto whitespace-pre-line text-center;
142
+ overflow-wrap: break-word;
143
+ word-wrap: break-word;
144
+ -ms-word-break: break-all;
145
+ word-break: break-word;
146
+ -ms-hyphens: auto;
147
+ -moz-hyphens: auto;
148
+ -webkit-hyphens: auto;
149
+ hyphens: auto;
150
+ }
151
+
152
+ </style>
153
+
154
+ <style>
155
+
156
+ .confirm-outer-enter-active,
157
+ .confirm-outer-leave-active {
158
+ transition: opacity 100ms cubic-bezier(0.25, 1, 0.5, 1);
159
+ }
160
+
161
+ .confirm-outer-enter-from,
162
+ .confirm-outer-leave-to {
163
+ opacity: 0;
164
+ }
165
+
166
+ .confirm-enter-active,
167
+ .confirm-leave-active {
168
+ transition: all 300ms cubic-bezier(0.25, 1, 0.5, 1);
169
+ transform: translate3d(0, 0, 0);
170
+ }
171
+
172
+ .confirm-enter-from,
173
+ .confirm-leave-to {
174
+ transform: translate3d(0, 20px, 0);
175
+ opacity: 0;
176
+ }
177
+
178
+ </style>
@@ -1,6 +1,6 @@
1
1
  <template>
2
2
  <Teleport to=".Y29u">
3
- <div v-if="!!(computedState)" :class="$style.contextMenu" :style="computedStyle" ref="contextMenu">
3
+ <div v-if="!!(computedState)" :class="computedClass" :style="computedStyle" ref="contextMenu">
4
4
  <div :class="bodyClass">
5
5
  <slot name="default" :context="context"></slot>
6
6
  </div>
@@ -35,7 +35,9 @@ export default {
35
35
  dismiss: {
36
36
  type: Boolean,
37
37
  default: true
38
- }
38
+ },
39
+
40
+ width: String,
39
41
 
40
42
  },
41
43
 
@@ -46,6 +48,14 @@ export default {
46
48
 
47
49
  computed:{
48
50
 
51
+ computedClass(){
52
+ return [
53
+ this.$style.contextMenu,
54
+ this.class
55
+ ]
56
+ .join(' ')
57
+ },
58
+
49
59
  computedState(){
50
60
  return this.state || this.isOpen
51
61
  }
@@ -57,7 +67,8 @@ export default {
57
67
  computedStyle: null,
58
68
  isOpen: false,
59
69
  context: null,
60
- closing: false
70
+ closing: false,
71
+ currentCaller: null
61
72
  }
62
73
  },
63
74
 
@@ -83,7 +94,8 @@ export default {
83
94
  const transitionEnd = () => {
84
95
  window.addEventListener('click', this.onDismiss)
85
96
  window.addEventListener('scroll', this.onDismiss)
86
- this.$refs.contextMenu.removeEventListener('transitionend', transitionEnd)
97
+ if(this.$refs.contextMenu)
98
+ this.$refs.contextMenu.removeEventListener('transitionend', transitionEnd)
87
99
  this.$emit('open')
88
100
  }
89
101
 
@@ -106,11 +118,12 @@ export default {
106
118
 
107
119
  open(caller, context){
108
120
 
109
- if(this.isOpen){
121
+ const originalCaller = caller
122
+ if(this.isOpen && this.currentCaller !== caller){
110
123
  return this.close(() => {
111
124
  window.setTimeout(() => {
112
125
  this.open(caller, context)
113
- }, 30)
126
+ }, 66)
114
127
  })
115
128
  }
116
129
 
@@ -118,7 +131,7 @@ export default {
118
131
  this.isOpen = true
119
132
  }
120
133
 
121
- caller = caller ?? this.caller
134
+ caller = caller ?? this.caller
122
135
 
123
136
  if(caller){
124
137
 
@@ -129,86 +142,129 @@ export default {
129
142
 
130
143
  if(caller){
131
144
 
132
- this.$nextTick(() => {
133
- const rect = caller.getBoundingClientRect()
145
+ const media = this.$util.calculateMediaPrefix(window.innerWidth)
146
+ let maxHeight, transformOrigin, transform
147
+ let top, right, bottom, left
148
+ if([ '*', 'sm' ].includes(media)){
149
+ this.$nextTick(() => {
150
+ const rect = caller.getBoundingClientRect()
134
151
 
135
- let maxHeight
136
- let top, right, bottom, left
137
- let transformOrigin
152
+ top = Math.round(rect.y + rect.height)
153
+ transformOrigin = 'top left'
138
154
 
139
- switch(this.position){
155
+ if(top > (window.innerHeight / 2)){
156
+ top = undefined
157
+ bottom = Math.round(window.innerHeight - rect.y)
158
+ transformOrigin = 'bottom left'
159
+ transform = 'translate3d(0, -10px, 0)'
160
+ }
161
+ else{
162
+ transform = 'translate3d(0, 10px, 0)'
163
+ maxHeight = window.innerHeight - top - 36
164
+ }
140
165
 
141
- case 'bottom-right':
142
- right = window.innerWidth - (Math.round(rect.x) + rect.width)
143
- top = Math.round(rect.y + rect.height + 8)
144
- maxHeight = window.innerHeight - Math.round(rect.y + rect.height + 16)
145
- transformOrigin = 'top right'
146
- break
166
+ this.computedStyle = {
167
+ left: '10px',
168
+ right: '10px',
169
+ top: top ? top + 'px' : top,
170
+ bottom: bottom ? bottom + 'px' : bottom,
171
+ maxHeight: maxHeight ? maxHeight + 'px' : maxHeight,
172
+ transformOrigin: transformOrigin,
173
+ transform
174
+ }
147
175
 
148
- case 'top-left':
149
- maxHeight = Math.round(rect.top - 16)
150
- bottom = window.innerHeight - rect.top + 8
151
- left = Math.round(rect.x)
152
- transformOrigin = 'bottom left'
153
- break
154
-
155
- case 'top-right':
156
- maxHeight = Math.round(rect.top - 16)
157
- bottom = window.innerHeight - rect.top + 8
158
- right = window.innerWidth - (Math.round(rect.x) + rect.width)
159
- transformOrigin = 'bottom right'
160
- break
161
-
162
- default:
163
- left = Math.round(rect.x)
164
- top = Math.round(rect.y + rect.height + 8)
165
- //maxHeight = window.innerHeight - Math.round(rect.y + rect.height + 16)
166
- transformOrigin = 'top left'
167
- break
168
- }
169
-
170
- if(left){
171
- if(left + this.$refs.contextMenu.clientWidth >= (window.innerWidth - 16)){
172
- left = window.innerWidth - (this.$refs.contextMenu.clientWidth + 16)
173
-
174
- if(transformOrigin === 'top left'){
176
+ this.onOpen()
177
+ })
178
+ }
179
+ else{
180
+ this.$nextTick(() => {
181
+ const rect = caller.getBoundingClientRect()
182
+
183
+ switch(this.position){
184
+
185
+ case 'bottom-right':
186
+ right = window.innerWidth - (Math.round(rect.x) + rect.width)
187
+ top = Math.round(rect.y + rect.height + 8)
188
+ maxHeight = window.innerHeight - Math.round(rect.y + rect.height + 16)
175
189
  transformOrigin = 'top right'
190
+ break
191
+
192
+ case 'top-left':
193
+ maxHeight = Math.round(rect.top - 16)
194
+ bottom = window.innerHeight - rect.top + 8
195
+ left = Math.round(rect.x)
196
+ transformOrigin = 'bottom left'
197
+ break
198
+
199
+ case 'top-right':
200
+ maxHeight = Math.round(rect.top - 16)
201
+ bottom = window.innerHeight - rect.top + 8
202
+ right = window.innerWidth - (Math.round(rect.x) + rect.width)
203
+ transformOrigin = 'bottom right'
204
+ break
205
+
206
+ case 'right':
207
+ left = Math.round(rect.x + rect.width)
208
+ top = Math.round(rect.y - 1)
209
+ transformOrigin = 'top left'
210
+ break
211
+
212
+ default:
213
+ left = Math.round(rect.x)
214
+ top = Math.round(rect.y + rect.height + 8)
215
+ //maxHeight = window.innerHeight - Math.round(rect.y + rect.height + 16)
216
+ transformOrigin = 'top left'
217
+ break
218
+ }
219
+
220
+ if(left){
221
+ if(left + this.$refs.contextMenu.clientWidth >= (window.innerWidth - 16)){
222
+ left = window.innerWidth - (this.$refs.contextMenu.clientWidth + 16)
223
+
224
+ if(transformOrigin === 'top left'){
225
+ transformOrigin = 'top right'
226
+ }
176
227
  }
177
228
  }
178
- }
179
229
 
180
- if(top){
181
- if(top + this.$refs.contextMenu.clientHeight >= (window.innerHeight - 16)){
182
- top = window.innerHeight - (this.$refs.contextMenu.clientHeight + 16)
230
+ if(top){
231
+ if(top + this.$refs.contextMenu.clientHeight >= (window.innerHeight - 16)){
232
+ top = window.innerHeight - (this.$refs.contextMenu.clientHeight + 16)
183
233
 
184
- if(transformOrigin === 'top left'){
185
- transformOrigin = 'bottom left'
234
+ if(transformOrigin === 'top left'){
235
+ transformOrigin = 'bottom left'
236
+ }
237
+ else if(transformOrigin === 'top right'){
238
+ transformOrigin = 'bottom right'
239
+ }
186
240
  }
187
- else if(transformOrigin === 'top right'){
188
- transformOrigin = 'bottom right'
241
+
242
+ if(top < 0){
243
+ top = 0
189
244
  }
190
245
  }
191
246
 
192
- if(top < 0){
193
- top = 0
194
- }
195
- }
247
+ maxHeight = this.$refs.contextMenu.clientHeight > window.innerHeight * .8 ?
248
+ Math.round(window.innerHeight * .8) : this.$refs.contextMenu.clientHeight + 24
196
249
 
197
- maxHeight = this.$refs.contextMenu.clientHeight > window.innerHeight * .8 ?
198
- Math.round(window.innerHeight * .8) : this.$refs.contextMenu.clientHeight + 24
250
+ this.computedStyle = {
251
+ left: left ? left + 'px' : left,
252
+ right: right ? right + 'px' : right,
253
+ top: top ? top + 'px' : top,
254
+ bottom: bottom ? bottom + 'px' : bottom,
255
+ maxHeight: maxHeight ? maxHeight + 'px' : maxHeight,
256
+ transformOrigin: transformOrigin
257
+ }
199
258
 
200
- this.computedStyle = {
201
- left: left ? left + 'px' : left,
202
- right: right ? right + 'px' : right,
203
- top: top ? top + 'px' : top,
204
- bottom: bottom ? bottom + 'px' : bottom,
205
- maxHeight: maxHeight ? maxHeight + 'px' : maxHeight,
206
- transformOrigin: transformOrigin
207
- }
259
+ if(this.width === 'parent'){
260
+ this.computedStyle.width = parseInt(rect.width) + 'px'
261
+ }
208
262
 
209
- this.onOpen()
210
- })
263
+ this.onOpen()
264
+ })
265
+ }
211
266
 
267
+ this.currentCaller = originalCaller
212
268
  }
213
269
  else{
214
270
  console.error('Undefined caller for context menu')
@@ -220,6 +276,8 @@ export default {
220
276
  },
221
277
 
222
278
  close(fn){
279
+ if(!this.$refs.contextMenu) return
280
+
223
281
  const transitionEnd = () => {
224
282
  window.removeEventListener('click', this.onDismiss)
225
283
  window.removeEventListener('scroll', this.onDismiss)
@@ -230,11 +288,25 @@ export default {
230
288
  this.computedStyle = null
231
289
  this.isOpen = false
232
290
  this.$emit('dismiss')
233
- if(fn) fn()
291
+ if(typeof fn === 'function') fn()
234
292
  }
235
293
  this.$refs.contextMenu.removeEventListener('transitionend', transitionEnd)
236
294
  this.$refs.contextMenu.addEventListener('transitionend', transitionEnd)
237
295
  this.$refs.contextMenu.classList.remove(this.$style.active)
296
+ },
297
+
298
+ toggle(caller, context){
299
+
300
+ if(this.isOpen){
301
+ this.close()
302
+ }
303
+ else{
304
+ this.open(caller, context)
305
+ }
306
+ },
307
+
308
+ opened(){
309
+ return this.isOpen
238
310
  }
239
311
 
240
312
  }
@@ -246,16 +318,32 @@ export default {
246
318
  <style module>
247
319
 
248
320
  .contextMenu{
249
- @apply fixed z-20 bg-base-50 backdrop-blur-md min-w-[150px] overflow-y-auto rounded-lg;
250
- @apply border-[1px] border-text-50 shadow-2xl whitespace-nowrap;
321
+ @apply fixed z-20 panel-500 min-w-[150px] overflow-y-auto rounded-xl;
322
+ @apply border-[2px] border-text-200 shadow-2xl whitespace-nowrap;
251
323
  transition: all 150ms cubic-bezier(0.25, 1, 0.5, 1);
252
324
  opacity: 0;
253
- transform: scale(.3);
254
325
  }
255
326
 
256
327
  .active{
257
328
  opacity: 1;
258
- transform: scale(1);
329
+ transform: translate3d(0, 0, 0);
330
+ }
331
+
332
+ @media screen(md){
333
+
334
+ .contextMenu{
335
+ @apply fixed z-20 panel-500 min-w-[150px] overflow-y-auto rounded-lg;
336
+ @apply border-[1px] border-text-50 shadow-2xl whitespace-nowrap;
337
+ transition: all 150ms cubic-bezier(0.25, 1, 0.5, 1);
338
+ opacity: 0;
339
+ transform: scale(.1);
340
+ }
341
+
342
+ .active{
343
+ opacity: 1;
344
+ transform: scale(1);
345
+ }
346
+
259
347
  }
260
348
 
261
- </style>
349
+ </style>
@@ -0,0 +1,161 @@
1
+ <template>
2
+ <div :class="$style.comp">
3
+
4
+ <div class="flex-1 p-4 overflow-y-auto">
5
+
6
+ <div class="flex flex-col gap-2 mx-auto max-w-[540px]">
7
+
8
+ <div v-for="(sequence, index) in conversation.sequences">
9
+
10
+ <div v-if="index < 1" class="py-3">
11
+ <div class="bg-green-100 p-2 rounded-lg text-black max-w-[60%]">
12
+ [NSC-KPG]
13
+ </div>
14
+ </div>
15
+ <div v-else class="py-3">
16
+ <div class="bg-green-100 p-2 rounded-lg text-black max-w-[60%] h-[36px]"></div>
17
+ </div>
18
+
19
+ <div class="border-t-[1px] border-dashed border-text-300"></div>
20
+
21
+ <div>
22
+ <div v-for="out in sequence.out">
23
+ <pre>{{ out }}</pre>
24
+ </div>
25
+
26
+ <button type="button" @click="sequence.out.push({})">Add Out</button>
27
+ </div>
28
+
29
+ <div class="border-t-[1px] border-dashed border-text-300"></div>
30
+
31
+ <div v-if="index > 0">
32
+ <div v-for="fallback in sequence.fallback">
33
+ <pre>{{ fallback }}</pre>
34
+ </div>
35
+
36
+ <button type="button" @click="sequence.fallback.push({})">Add Fallback</button>
37
+ </div>
38
+
39
+ </div>
40
+
41
+ <button @click="conversation.sequences.push({ in:{}, out:[], fallback:[] })">Add Sequence</button>
42
+
43
+ </div>
44
+
45
+ </div>
46
+
47
+ <div class="w-[400px] bg-base-400 p-6">
48
+
49
+ <div class="flex flex-col gap-6">
50
+ <div>
51
+ <label class="text-text-400">Type</label>
52
+ <Dropdown class="mt-1">
53
+ <option>Whatsapp</option>
54
+ <option>Livechat</option>
55
+ </Dropdown>
56
+ </div>
57
+
58
+ <div>
59
+ <div class="flex flex-row gap-2">
60
+ <label class="text-text-400">Criteria</label>
61
+ <button type="button" class="text-primary" @click="">Add Criteria</button>
62
+ </div>
63
+ <div class="mt-1">
64
+ <div class="flex flex-row gap-2">
65
+ <Dropdown class="w-[100px]">
66
+ <option>Text</option>
67
+ </Dropdown>
68
+ <Dropdown class="w-[100px]">
69
+ <option>Starts with</option>
70
+ </Dropdown>
71
+ <Textbox />
72
+ </div>
73
+ </div>
74
+ </div>
75
+ </div>
76
+
77
+ </div>
78
+
79
+ </div>
80
+ </template>
81
+
82
+ <script>
83
+
84
+ export default{
85
+
86
+ data(){
87
+ return {
88
+ conversation: {
89
+ isActive: 1,
90
+ name: 'Conversation 1',
91
+ description: 'Conversation 1 Description',
92
+ startDate: '2023-01-01',
93
+ endDate: '2023-01-01',
94
+ sequences: [
95
+
96
+ /*{
97
+ id: 1,
98
+ in: {
99
+ type: 'whatsapp',
100
+ filters: [
101
+ { key:'text', operator:'contains', value:'halo' }
102
+ ]
103
+ },
104
+ out: [
105
+ {
106
+ type: 'whatsapp',
107
+ text: 'Halo, selamat datang di NSC-PNK, silahkan masukkan nama dan alamat anda'
108
+ },
109
+ {
110
+ type: 'whatsapp',
111
+ text: 'Nama:<br/>Alamat:<br/>Propinsi:<br/>Kota:'
112
+ }
113
+ ]
114
+ },
115
+
116
+ {
117
+ id: 2,
118
+ in: {
119
+ type: 'whatsapp',
120
+ filters: [
121
+ { key:'text', operator:'contains', value:'nama:' },
122
+ ]
123
+ },
124
+ out: [
125
+ {
126
+ type: 'whatsapp',
127
+ text: 'Terima kasih, kami akan segera menghubungi anda'
128
+ },
129
+ {
130
+ type: 'send-api',
131
+ text: 'Send API'
132
+ },
133
+ {
134
+ type: 'leave-chat',
135
+ text: 'Leave Chat'
136
+ }
137
+ ],
138
+ fallback: [
139
+ {
140
+ type: 'whatsapp',
141
+ text: 'Maaf, kami tidak mengerti'
142
+ }
143
+ ]
144
+ }*/
145
+
146
+ ]
147
+ },
148
+ }
149
+ }
150
+
151
+ }
152
+
153
+ </script>
154
+
155
+ <style module>
156
+
157
+ .comp{
158
+ @apply flex flex-row;
159
+ }
160
+
161
+ </style>