@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
package/LICENSE CHANGED
@@ -1,3 +1,4 @@
1
+
1
2
  MIT License
2
3
 
3
4
  Copyright (c) 2022 mixd-id
@@ -0,0 +1,16 @@
1
+ # Header 2
2
+
3
+ ### Properties
4
+ | Name | Type | Default | Description |
5
+ |--------------------------|--------|---------|----------------------------|
6
+ | `logo` | Array | [] | Responsive Array of Object |
7
+ | `logo[].url` | String | | Logo url |
8
+ | `icons` | Array | {} | Responsive Array of Object |
9
+ | `icons[].items` | Array | {} | Array of Object |
10
+ | `icons[].items[].icon` | String | | (required) icon value |
11
+ | `icons[].items[].target` | String | | (required) target value |
12
+ | `icons[].items[].text` | String | route | route, search |
13
+ | `menu[].items[].icon` | String | | svg, image |
14
+ | `menu[].items[].text` | String | | |
15
+ | `menu[].items[].target` | String | | |
16
+ | `menu[].items[].items` | Array | | |
File without changes
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@mixd-id/web-scaffold",
3
3
  "private": false,
4
- "version": "0.1.2301231369",
4
+ "version": "0.2.240702",
5
5
  "scripts": {
6
6
  "dev": "vite serve",
7
7
  "build": "vite build",
@@ -11,12 +11,26 @@
11
11
  "exports": {
12
12
  ".": "./src/index.js",
13
13
  "./themes/default": "./src/themes/default/index.js",
14
+ "./components/*": "./src/components/*",
15
+ "./mixin/*": "./src/mixin/*",
16
+ "./widgets/*": "./src/widgets/*",
17
+ "./middleware/http/trim-string": "./src/middleware/http/trim-string.js",
14
18
  "./helpers": {
15
19
  "require": "./src/utils/helpers.js",
16
20
  "import": "./src/utils/helpers.mjs"
17
21
  },
22
+ "./wss": {
23
+ "require": "./src/utils/wss.js",
24
+ "import": "./src/utils/wss.mjs"
25
+ },
18
26
  "./importer": "./src/utils/importer.js",
19
- "./listpage1": "./src/utils/listpage1.js"
27
+ "./listpage1": "./src/utils/listpage1.js",
28
+ "./listview": "./src/utils/listview.js",
29
+ "./preset-selector": {
30
+ "require": "./src/utils/preset-selector.js",
31
+ "import": "./src/utils/preset-selector.mjs"
32
+ },
33
+ "./web": "./src/utils/web.js"
20
34
  },
21
35
  "dependencies": {
22
36
  "@faker-js/faker": "^7.3.0",
@@ -24,13 +38,14 @@
24
38
  "@tailwindcss/line-clamp": "^0.4.0",
25
39
  "@vueuse/core": "^9.0.2",
26
40
  "adm-zip": "^0.5.10",
27
- "axios": "^1.3.4",
28
41
  "chart.js": "^4.2.1",
29
42
  "compression": "^1.7.4",
30
43
  "cookie-parser": "^1.4.6",
31
44
  "cors": "^2.8.5",
32
- "daisyui": "^2.19.0",
45
+ "crypto-js": "^4.2.0",
33
46
  "dayjs": "^1.11.2",
47
+ "eventemitter2": "^6.4.7",
48
+ "events": "^3.3.0",
34
49
  "exceljs": "^4.3.0",
35
50
  "express": "^4.18.1",
36
51
  "file-type": "^18.2.1",
@@ -40,11 +55,13 @@
40
55
  "nprogress": "^0.2.0",
41
56
  "pinia": "^2.0.14",
42
57
  "prismjs": "^1.28.0",
58
+ "redis": "^4.6.13",
43
59
  "serve-static": "^1.15.0",
44
60
  "tailwindcss": "^3.2.4",
45
61
  "vue": "^3.2.25",
46
62
  "vue-chartjs": "^5.2.0",
47
- "vue-router": "^4.0.14"
63
+ "vue-router": "^4.0.14",
64
+ "ws": "^8.16.0"
48
65
  },
49
66
  "devDependencies": {
50
67
  "@vitejs/plugin-vue": "^2.2.0",
package/src/App.vue CHANGED
@@ -4,6 +4,14 @@
4
4
 
5
5
  <script>
6
6
 
7
+ export default {
8
+ name: 'App',
9
+
10
+ setup(){
11
+
12
+ }
13
+ }
14
+
7
15
  </script>
8
16
 
9
17
  <style>
@@ -14,4 +22,4 @@
14
22
  <style module>
15
23
 
16
24
 
17
- </style>
25
+ </style>
@@ -1,34 +1,200 @@
1
1
  <template>
2
- <a v-if="isExternalLink" :href="href" :target="target">
3
- <slot />
2
+ <a v-if="isExternalLink" :href="href" :target="target" :class="compClass" :style="computedStyle">
3
+ <slot>{{ text }}</slot>
4
4
  </a>
5
- <router-link v-else :to="href" :target="target">
6
- <slot />
5
+ <router-link v-else :to="href" :target="target" :class="compClass">
6
+ <slot>{{ text }}</slot>
7
7
  </router-link>
8
8
  </template>
9
9
 
10
10
  <script>
11
11
 
12
+ import {componentMixin} from "../mixin/component";
13
+
12
14
  export default {
13
15
 
16
+ mixins: [ componentMixin ],
17
+
14
18
  props: {
15
19
 
16
- href: String,
20
+ href: {
21
+ type: String,
22
+ default: ''
23
+ },
24
+
25
+ target: String,
17
26
 
18
- target: String
27
+ text: String,
28
+
29
+ variant: {
30
+ type: [ String, Number ],
31
+ default: "primary" // primary|secondary|outline, default:primary
32
+ },
19
33
 
20
34
  },
21
35
 
22
36
  computed: {
23
37
 
24
38
  isExternalLink() {
25
- return typeof this.href === 'string' && (this.href.startsWith('http') || this.href.startsWith('tel:'))
26
- }
39
+ return typeof this.href === 'string' && this.href.indexOf('://') > 0
40
+ },
41
+
42
+ compClass(){
43
+ return [
44
+ this.$style.button,
45
+ this.$style['button-' + this.variant]
46
+ ]
47
+ .filter(_ => _)
48
+ .join(' ')
49
+ },
50
+
27
51
  },
28
52
  }
29
53
  </script>
30
54
 
31
55
  <style module>
32
56
 
57
+ .button{
58
+ @apply p-2 h-[var(--h-cp)];
59
+ @apply relative flex items-center justify-center;
60
+ @apply whitespace-nowrap text-ellipsis overflow-hidden;
61
+ @apply rounded-lg;
62
+ }
63
+ .button>*:first-child{
64
+ @apply flex items-center justify-center
65
+ }
66
+ .button:disabled{
67
+ @apply opacity-60;
68
+ }
69
+ .button:active{
70
+ @apply top-[1px] left-[1px] relative;
71
+ }
72
+
73
+ .button-primary{
74
+ @apply bg-primary-500 text-white rounded-lg;
75
+ box-shadow: 0 2px 1px rgba(0, 0, 0, .05);
76
+ outline: solid 1px rgb(var(--primary-700));
77
+ border: solid 1px rgb(var(--primary-400));
78
+ }
79
+ .button-primary:focus{
80
+ outline-color: rgb(var(--primary-800));
81
+ border-color: rgb(var(--primary-600));
82
+ }
83
+ .button-primary:hover{
84
+ @apply bg-primary-600;
85
+ outline-color: rgb(var(--primary-800))
86
+ }
87
+ .button-primary:disabled{
88
+ @apply bg-primary-500 opacity-50 top-0 left-0 cursor-not-allowed;
89
+ @apply top-0 left-0;
90
+ outline: solid 1px rgb(var(--primary-700));
91
+ }
92
+ .button-primary *{
93
+ @apply text-white fill-white;
94
+ }
95
+ .button-primary.loading *{
96
+ @apply fill-transparent
97
+ }
98
+ .button-primary .svgBg{
99
+ stroke: #fff;
100
+ stroke-opacity: 25%;
101
+ }
102
+ .button-primary .svgHg{
103
+ fill: #fff;
104
+ fill-opacity: 75%;
105
+ }
106
+
107
+ .button-outline{
108
+ @apply bg-transparent text-primary-500;
109
+ outline: solid 1px rgb(var(--primary-700));
110
+ }
111
+ .button-outline:hover{
112
+ outline-color: rgb(var(--primary-800))
113
+ }
114
+ .button-outline:disabled{
115
+ @apply opacity-50 top-0 left-0 cursor-not-allowed;
116
+ @apply text-text border-primary-500;
117
+ }
118
+ .button-outline *{
119
+ @apply text-primary-500 fill-primary-500;
120
+ }
121
+ .button-outline.loading *{
122
+ @apply fill-transparent
123
+ }
124
+ .button-outline .svgBg{
125
+ stroke: rgb(var(--primary-600));
126
+ stroke-opacity: 50%;
127
+ }
128
+ .button-outline .svgHg{
129
+ fill: rgb(var(--primary));
130
+ fill-opacity: 100%;
131
+ }
132
+
133
+ .button-secondary{
134
+ @apply bg-secondary text-text-500 rounded-lg;
135
+ box-shadow: 0 2px 1px rgba(0, 0, 0, .05);
136
+ outline: solid 1px rgb(var(--secondary-700));
137
+ border: solid 1px rgb(var(--secondary-400));
138
+ }
139
+ .button-secondary:hover{
140
+ @apply bg-secondary-600;
141
+ outline-color: rgb(var(--secondary-800))
142
+ }
143
+ .button-secondary:disabled{
144
+ @apply bg-secondary-500 opacity-50 top-0 left-0 cursor-not-allowed;
145
+ outline: solid 1px rgb(var(--secondary-700));
146
+ }
147
+ .button-secondary *{
148
+ @apply text-text-500 fill-white;
149
+ }
150
+ .button-secondary.loading *{
151
+ @apply fill-transparent
152
+ }
153
+ .button-secondary .svgBg{
154
+ stroke: rgb(var(--text-400));
155
+ stroke-opacity: 25%;
156
+ }
157
+ .button-secondary .svgHg{
158
+ fill: rgb(var(--text-500));
159
+ fill-opacity: 75%;
160
+ }
161
+
162
+ .button-red{
163
+ @apply bg-red-500 text-white rounded-md border-[2px] border-red-500;
164
+ }
165
+ .button-red:hover{
166
+ @apply bg-red-600 border-red-600;
167
+ }
168
+ .button-red:disabled{
169
+ @apply bg-red-500 border-red-500 opacity-50 top-0 left-0 cursor-not-allowed;
170
+ }
171
+ .button-red *{
172
+ @apply text-white fill-white;
173
+ }
174
+ .button-red.loading *{
175
+ @apply fill-transparent
176
+ }
177
+ .button-red .svgBg{
178
+ @apply stroke-red-400;
179
+ stroke-opacity: 50%;
180
+ }
181
+ .button-red .svgHg{
182
+ @apply fill-text-500;
183
+ fill-opacity: 100%;
184
+ }
185
+
186
+ .button-minimal{
187
+ @apply border-[2px] border-transparent;
188
+ }
189
+ .button-minimal:hover{
190
+ }
191
+ .button-minimal .svgBg{
192
+ stroke: rgb(var(--text-500));
193
+ stroke-opacity: 25%;
194
+ }
195
+ .button-minimal .svgHg{
196
+ fill: rgb(var(--text));
197
+ fill-opacity: 75%;
198
+ }
33
199
 
34
- </style>
200
+ </style>
@@ -1,43 +1,48 @@
1
1
  <template>
2
2
  <Teleport to=".YWxl">
3
3
  <Transition name="alert-outer">
4
- <div v-if="!!state" :class="$style.alert" ref="alert">
4
+ <div v-if="isOpen" :class="$style.alert" ref="alert">
5
5
  <Transition name="alert" @after-appear="onAfterAppear" appear>
6
- <div class="p-4 flex flex-col items-center leading-6">
7
-
8
- <slot v-if="$slots['icon']" name="icon"></slot>
9
- <svg v-else-if="mode === 'alert'" width="100" height="100" class="fill-red-500" 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
- <svg v-else-if="mode === 'confirm'" width="100" height="100" class="fill-text-300" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
15
- <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"/>
16
- <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"/>
17
- <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"/>
18
- </svg>
19
-
20
- <div class="my-4 text-center flex-1 overflow-y-auto">
21
- <h5 class="my-1 break-all">{{ title }}</h5>
22
- <p class="break-all overflow-y-auto whitespace-pre-line text-left">{{ description }}</p>
6
+ <div :class="$style.cont1">
7
+
8
+ <div :class="$style.cont2">
9
+ <slot v-if="$slots['icon']" name="icon"></slot>
10
+ <svg width="100" height="100" class="fill-red-500" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
11
+ <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"/>
12
+ <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"/>
13
+ <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"/>
14
+ </svg>
15
+ <h5 :class="$style.title">{{ title }}</h5>
23
16
  </div>
24
-
25
- <div class="mt-4" v-if="mode === 'alert'">
26
- <Button @click="$emit('dismiss')" class="min-w-[88px]">
27
- <strong class="px-4">
28
- {{ text }}
29
- </strong>
30
- </Button>
17
+
18
+ <div :class="$style.details">
19
+ <p class="text-center break-words whitespace-pre-line" v-if="message">{{ message }}</p>
20
+ <p class="text-center break-words max-w-[420px] whitespace-pre-line" v-if="stack">{{ stack }}</p>
21
+ </div>
22
+
23
+ <div :class="$style.details" v-if="details">
24
+ <div v-if="!showDetails" class="text-center">
25
+ <button type="button" class="text-primary" @click="showDetails = true">Open Details</button>
26
+ </div>
27
+ <div v-else class="flex flex-col gap-4">
28
+ <div v-for="(v, k) in details">
29
+ <small class="font-bold">{{ k }}</small>
30
+ <div class="block break-all text-sm">{{ v }}</div>
31
+ </div>
32
+
33
+ <div class="self-stretch text-center">
34
+ <button type="button" class="text-primary text-sm" @click="copy">Copy Details</button>
35
+ </div>
36
+ </div>
31
37
  </div>
32
- <div class="mt-4 flex flex-row gap-2" v-else-if="mode === 'confirm'">
33
- <Button @click="$emit('confirm')" class="min-w-[88px]">
38
+
39
+ <div>
40
+ <br />
41
+ <Button ref="btnOK" @click="onConfirm">
34
42
  <strong class="px-4">
35
- {{ text }}
43
+ {{ buttonText }}
36
44
  </strong>
37
45
  </Button>
38
- <Button variant="minimal" @click="$emit('dismiss')" class="min-w-[88px] px-4 hover:text-primary">
39
- Cancel
40
- </Button>
41
46
  </div>
42
47
  </div>
43
48
  </Transition>
@@ -48,69 +53,148 @@
48
53
 
49
54
  <script>
50
55
 
56
+ import {copyToClipboard, unPascalCase} from "../utils/helpers.mjs";
57
+ import Button from "./Button.vue";
58
+
51
59
  export default{
52
60
 
53
- props: {
54
- state: Object,
55
- mode: {
56
- type: String,
57
- default: 'alert' // alert | confirm
61
+ components: {
62
+ Button
63
+ },
64
+
65
+ methods: {
66
+
67
+ /**
68
+ * @param {object} obj - The alert object
69
+ * @param {string} [obj.title] - The title of the alert
70
+ * @param {string} obj.message - The message of the alert
71
+ * @param {string} [obj.buttonText] - The text of the button
72
+ * @param {function} [obj.onConfirm] - The callback function when the alert button is clicked
73
+ */
74
+ open(obj){
75
+ this.alert = obj
76
+ this.isOpen = true
77
+ this.showDetails = false
78
+ },
79
+
80
+ close(){
81
+ this.isOpen = false
82
+ },
83
+
84
+ copy(){
85
+ const text = []
86
+ for(let key in this.details){
87
+ text.push(`${key}\n${this.details[key]}\n\n`)
88
+ }
89
+ copyToClipboard(text.join("\n"))
58
90
  },
59
- text: {
60
- type: String,
61
- default: 'OK'
91
+
92
+ onAfterAppear(){
93
+ window.setTimeout(() => {
94
+ console.log(this.$refs)
95
+ }, 2000)
96
+ //this.$refs.btnOK.focus()
97
+ this.$emit('appear')
98
+
99
+ },
100
+
101
+ onConfirm(){
102
+ if(typeof this.alert.onConfirm === 'function'){
103
+ this.alert.onConfirm()
104
+ }
105
+ this.close()
62
106
  }
107
+
63
108
  },
64
109
 
65
110
  computed: {
66
111
 
112
+ buttonText(){
113
+ return this.alert.buttonText ?? this.$t('OK')
114
+ },
115
+
116
+ err(){
117
+ return this.alert.reason && this.alert.reason.response ? this.alert.reason.response.data :
118
+ (this.alert.response && this.alert.response.data ? this.alert.response.data : this.alert)
119
+ },
120
+
67
121
  title(){
68
- let title
69
122
 
70
- if(this.state && this.state.title){
71
- if(typeof this.state.title === 'object' && this.state.title.type === 'ValidationError'){
72
- title = 'Validation error'
73
- }
74
- else{
75
- title = this.state.title
76
- }
123
+ if(this.err.title){
124
+ return this.err.title
125
+ }
126
+ else if(this.err.name){
127
+ return unPascalCase(this.err.name)
128
+ }
129
+ else if(this.err.type){
130
+ return unPascalCase(this.err.type)
77
131
  }
132
+ else if(this.err.status){
133
+ return `Error ${this.err.status}`
134
+ }
135
+ else{
136
+ return this.$t('Alert')
137
+ }
138
+ },
78
139
 
79
- return title
140
+ message(){
141
+ if(this.err.errors){
142
+ return typeof this.err.errors === 'object' &&
143
+ Object.keys(this.err.errors).length > 0 ?
144
+ Object.values(this.err.errors).map(_ => {
145
+ if(Array.isArray(_))
146
+ return _
147
+ return JSON.stringify(_)
148
+ })
149
+ .join("\n"):
150
+ this.err.errors
151
+ }
152
+ else if(this.err.reason){
153
+ if(this.err.reason.stack){
154
+ return this.err.reason.stack
155
+ }
156
+ else{
157
+ return this.err.reason
158
+ }
159
+ }
160
+ else if(this.err.message){
161
+ return this.err.message
162
+ }
163
+ else{
164
+ return ''
165
+ }
80
166
  },
81
167
 
82
- description(){
83
- let description
168
+ stack(){
169
+ if(this.err.stack){
170
+ return this.err.stack
171
+ }
172
+ },
84
173
 
85
- if(this.state){
174
+ details(){
86
175
 
87
- if(typeof this.state.title === 'object' && this.state.title.type === 'ValidationError'){
88
- description = {}
89
- for(let key in this.state.title.errors){
90
- this.state.title.errors[key].forEach((text) => {
91
- description[text] = 1
92
- })
93
- }
94
- description = Object.keys(description).join("\n")
95
- }
96
- else{
97
- description = this.state.description
176
+ if(this.alert.details && typeof this.alert.details === 'object'){
177
+ const details = {}
178
+ for(let key in this.alert.details){
179
+ if([ 'name', 'title', 'message' ].includes(key)) continue
180
+
181
+ details[key] = typeof this.alert.details[key] === 'object' ?
182
+ JSON.stringify(this.alert.details[key]) :
183
+ this.alert.details[key]
98
184
  }
185
+ return Object.keys(details).length > 0 ? details : null
99
186
  }
100
187
 
101
- return description
102
188
  }
103
189
 
104
190
  },
105
191
 
106
- emits: [ 'appear', 'confirm', 'dismiss' ],
107
-
108
- methods: {
109
-
110
- onAfterAppear(){
111
- this.$emit('appear')
192
+ data(){
193
+ return {
194
+ alert: {},
195
+ isOpen: false,
196
+ showDetails: false
112
197
  }
113
-
114
198
  }
115
199
 
116
200
  }
@@ -120,15 +204,37 @@ export default{
120
204
  <style module>
121
205
 
122
206
  .alert{
123
- @apply fixed top-0 left-0 flex w-screen h-screen px-8;
124
- @apply items-center justify-center bg-black/70 backdrop-blur-md;
207
+ @apply fixed top-0 left-0 flex w-screen h-screen;
208
+ @apply items-center justify-center bg-white/50 backdrop-blur-md;
125
209
  z-index: 60;
126
210
  }
211
+ [data-theme="dark"] .alert{
212
+ @apply bg-black/50;
213
+ }
127
214
 
128
215
  .alert>*{
129
- @apply max-h-[50vh] overflow-y-auto bg-base-500 rounded-xl;
216
+ @apply max-h-[60vh] overflow-y-auto bg-base-500 rounded-xl;
130
217
  @apply border-[1px] border-text-50;
131
- @apply min-w-[280px] max-w-[80vw] md:max-w-[400px];
218
+ @apply min-w-[280px] max-w-[80vw] md:max-w-[480px];
219
+ }
220
+
221
+ .cont1{
222
+ @apply flex flex-col items-center p-6 gap-1;
223
+ }
224
+
225
+ .cont2{
226
+ @apply flex flex-col items-center;
227
+ }
228
+
229
+ .title{
230
+ @apply text-center;
231
+ }
232
+
233
+ .details{
234
+ @apply flex-1 flex flex-col gap-4 overflow-auto min-h-[1.6rem] self-stretch;
235
+ }
236
+ .details::-webkit-scrollbar {
237
+ display: none;
132
238
  }
133
239
 
134
240
  </style>
@@ -157,4 +263,4 @@ export default{
157
263
  opacity: 0;
158
264
  }
159
265
 
160
- </style>
266
+ </style>