@mixd-id/web-scaffold 0.1.230406001

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 (62) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +3 -0
  3. package/package.json +71 -0
  4. package/public/images/mixd-logo2.png +0 -0
  5. package/src/App.vue +17 -0
  6. package/src/components/Ahref.vue +34 -0
  7. package/src/components/Alert.vue +160 -0
  8. package/src/components/Button.vue +253 -0
  9. package/src/components/ButtonGroup.vue +101 -0
  10. package/src/components/Carousel.vue +293 -0
  11. package/src/components/ChatTyping.vue +69 -0
  12. package/src/components/Checkbox.vue +152 -0
  13. package/src/components/ContextMenu.vue +261 -0
  14. package/src/components/CopyToClipboard.vue +59 -0
  15. package/src/components/Countdown.vue +213 -0
  16. package/src/components/Datepicker.vue +312 -0
  17. package/src/components/Dropdown.vue +198 -0
  18. package/src/components/DynamicTemplate.vue +44 -0
  19. package/src/components/ErrorText.vue +36 -0
  20. package/src/components/Feed.vue +118 -0
  21. package/src/components/Gmaps.vue +227 -0
  22. package/src/components/Grid.vue +29 -0
  23. package/src/components/GridColumn.vue +31 -0
  24. package/src/components/HTMLEditor.vue +396 -0
  25. package/src/components/Image.vue +207 -0
  26. package/src/components/Image360.vue +140 -0
  27. package/src/components/ImageFullScreen.vue +101 -0
  28. package/src/components/ImagePreview.vue +71 -0
  29. package/src/components/ImportModal.vue +247 -0
  30. package/src/components/ListItem.vue +147 -0
  31. package/src/components/ListPage1.vue +1331 -0
  32. package/src/components/ListPage1Filter.vue +170 -0
  33. package/src/components/Modal.vue +253 -0
  34. package/src/components/OTPField.vue +126 -0
  35. package/src/components/Radio.vue +134 -0
  36. package/src/components/SearchButton.vue +57 -0
  37. package/src/components/Slider.vue +285 -0
  38. package/src/components/SplitPane.vue +129 -0
  39. package/src/components/Switch.vue +89 -0
  40. package/src/components/TabView.vue +106 -0
  41. package/src/components/TableView.vue +201 -0
  42. package/src/components/TableViewHead.vue +159 -0
  43. package/src/components/Tabs.vue +74 -0
  44. package/src/components/TextEditor.vue +85 -0
  45. package/src/components/Textarea.vue +184 -0
  46. package/src/components/Textbox.vue +200 -0
  47. package/src/components/Timepicker.vue +108 -0
  48. package/src/components/Toast.vue +93 -0
  49. package/src/components/VirtualScroll.vue +215 -0
  50. package/src/components/VirtualTable.vue +497 -0
  51. package/src/entry-client.js +27 -0
  52. package/src/entry-server.js +73 -0
  53. package/src/index.css +3 -0
  54. package/src/index.js +255 -0
  55. package/src/main.js +38 -0
  56. package/src/router.js +57 -0
  57. package/src/themes/default/index.js +200 -0
  58. package/src/utils/helpers.js +185 -0
  59. package/src/utils/helpers.mjs +197 -0
  60. package/src/utils/importer.js +156 -0
  61. package/src/utils/listpage1.js +1371 -0
  62. package/src/utils/selection.js +64 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2022 mixd-id
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,3 @@
1
+ # Web Scaffold for mixd.id
2
+
3
+ This scaffold based on express vitejs vuejs
package/package.json ADDED
@@ -0,0 +1,71 @@
1
+ {
2
+ "name": "@mixd-id/web-scaffold",
3
+ "private": false,
4
+ "version": "0.1.230406001",
5
+ "scripts": {
6
+ "dev": "vite serve",
7
+ "build": "vite build",
8
+ "start": "node server.js"
9
+ },
10
+ "main": "./src/index.js",
11
+ "exports": {
12
+ ".": "./src/index.js",
13
+ "./themes/default": "./src/themes/default/index.js",
14
+ "./helpers": {
15
+ "require": "./src/utils/helpers.js",
16
+ "import": "./src/utils/helpers.mjs"
17
+ },
18
+ "./importer": "./src/utils/importer.js",
19
+ "./listpage1": "./src/utils/listpage1.js"
20
+ },
21
+ "dependencies": {
22
+ "@faker-js/faker": "^7.3.0",
23
+ "@googlemaps/js-api-loader": "^1.15.1",
24
+ "@tailwindcss/line-clamp": "^0.4.0",
25
+ "@vueuse/core": "^9.0.2",
26
+ "adm-zip": "^0.5.10",
27
+ "axios": "^1.3.4",
28
+ "chart.js": "^4.2.1",
29
+ "compression": "^1.7.4",
30
+ "cookie-parser": "^1.4.6",
31
+ "cors": "^2.8.5",
32
+ "daisyui": "^2.19.0",
33
+ "dayjs": "^1.11.2",
34
+ "exceljs": "^4.3.0",
35
+ "express": "^4.18.1",
36
+ "file-type": "^18.2.1",
37
+ "glob": "^8.0.3",
38
+ "lodash": "^4.17.21",
39
+ "md5": "^2.3.0",
40
+ "nprogress": "^0.2.0",
41
+ "pinia": "^2.0.14",
42
+ "prismjs": "^1.28.0",
43
+ "serve-static": "^1.15.0",
44
+ "tailwindcss": "^3.2.4",
45
+ "vue": "^3.2.25",
46
+ "vue-chartjs": "^5.2.0",
47
+ "vue-router": "^4.0.14"
48
+ },
49
+ "devDependencies": {
50
+ "@vitejs/plugin-vue": "^2.2.0",
51
+ "autoprefixer": "^10.4.4",
52
+ "postcss": "^8.4.12",
53
+ "vite": "^2.8.0"
54
+ },
55
+ "description": "This scaffold based on express vitejs vuejs",
56
+ "repository": {
57
+ "type": "git",
58
+ "url": "git+https://github.com/mixd-id/web-scaffold.git"
59
+ },
60
+ "keywords": [
61
+ "mixd",
62
+ "mixd.id",
63
+ "mixd-id"
64
+ ],
65
+ "author": "mixd.id",
66
+ "license": "ISC",
67
+ "bugs": {
68
+ "url": "https://github.com/mixd-id/web-scaffold/issues"
69
+ },
70
+ "homepage": "https://github.com/mixd-id/web-scaffold#readme"
71
+ }
Binary file
package/src/App.vue ADDED
@@ -0,0 +1,17 @@
1
+ <template>
2
+ <router-view></router-view>
3
+ </template>
4
+
5
+ <script>
6
+
7
+ </script>
8
+
9
+ <style>
10
+
11
+
12
+ </style>
13
+
14
+ <style module>
15
+
16
+
17
+ </style>
@@ -0,0 +1,34 @@
1
+ <template>
2
+ <a v-if="isExternalLink" :href="href" :target="target">
3
+ <slot />
4
+ </a>
5
+ <router-link v-else :to="href" :target="target">
6
+ <slot />
7
+ </router-link>
8
+ </template>
9
+
10
+ <script>
11
+
12
+ export default {
13
+
14
+ props: {
15
+
16
+ href: String,
17
+
18
+ target: String
19
+
20
+ },
21
+
22
+ computed: {
23
+
24
+ isExternalLink() {
25
+ return typeof this.href === 'string' && (this.href.startsWith('http') || this.href.startsWith('tel:'))
26
+ }
27
+ },
28
+ }
29
+ </script>
30
+
31
+ <style module>
32
+
33
+
34
+ </style>
@@ -0,0 +1,160 @@
1
+ <template>
2
+ <Teleport to=".YWxl">
3
+ <Transition name="alert-outer">
4
+ <div v-if="!!state" :class="$style.alert" ref="alert">
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>
23
+ </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>
31
+ </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]">
34
+ <strong class="px-4">
35
+ {{ text }}
36
+ </strong>
37
+ </Button>
38
+ <Button variant="minimal" @click="$emit('dismiss')" class="min-w-[88px] px-4 hover:text-primary">
39
+ Cancel
40
+ </Button>
41
+ </div>
42
+ </div>
43
+ </Transition>
44
+ </div>
45
+ </Transition>
46
+ </Teleport>
47
+ </template>
48
+
49
+ <script>
50
+
51
+ export default{
52
+
53
+ props: {
54
+ state: Object,
55
+ mode: {
56
+ type: String,
57
+ default: 'alert' // alert | confirm
58
+ },
59
+ text: {
60
+ type: String,
61
+ default: 'OK'
62
+ }
63
+ },
64
+
65
+ computed: {
66
+
67
+ title(){
68
+ let title
69
+
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
+ }
77
+ }
78
+
79
+ return title
80
+ },
81
+
82
+ description(){
83
+ let description
84
+
85
+ if(this.state){
86
+
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
98
+ }
99
+ }
100
+
101
+ return description
102
+ }
103
+
104
+ },
105
+
106
+ emits: [ 'appear', 'confirm', 'dismiss' ],
107
+
108
+ methods: {
109
+
110
+ onAfterAppear(){
111
+ this.$emit('appear')
112
+ }
113
+
114
+ }
115
+
116
+ }
117
+
118
+ </script>
119
+
120
+ <style module>
121
+
122
+ .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;
125
+ z-index: 60;
126
+ }
127
+
128
+ .alert>*{
129
+ @apply max-h-[50vh] overflow-y-auto bg-base-500 rounded-xl;
130
+ @apply border-[1px] border-text-50;
131
+ @apply min-w-[280px] max-w-[80vw] md:max-w-[400px];
132
+ }
133
+
134
+ </style>
135
+
136
+ <style>
137
+
138
+ .alert-outer-enter-active,
139
+ .alert-outer-leave-active {
140
+ transition: opacity 100ms cubic-bezier(0.25, 1, 0.5, 1);
141
+ }
142
+
143
+ .alert-outer-enter-from,
144
+ .alert-outer-leave-to {
145
+ opacity: 0;
146
+ }
147
+
148
+ .alert-enter-active,
149
+ .alert-leave-active {
150
+ transition: all 300ms cubic-bezier(0.25, 1, 0.5, 1);
151
+ transform: translate3d(0, 0, 0);
152
+ }
153
+
154
+ .alert-enter-from,
155
+ .alert-leave-to {
156
+ transform: translate3d(0, 20px, 0);
157
+ opacity: 0;
158
+ }
159
+
160
+ </style>
@@ -0,0 +1,253 @@
1
+ <template>
2
+ <button :class="computedClass" :disabled="isDisabled">
3
+ <div>
4
+ <slot></slot>
5
+ </div>
6
+ <div v-if="isLoading" :class="$style.loadingPane">
7
+ <svg :class="$style.spinner" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24">
8
+ <circle :class="$style.svgBg" cx="12" cy="12" r="10" stroke-width="4"></circle>
9
+ <path :class="$style.svgHg" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"></path>
10
+ </svg>
11
+ </div>
12
+ </button>
13
+ </template>
14
+
15
+ <script>
16
+
17
+ export default{
18
+
19
+ props: {
20
+
21
+ variant: {
22
+ type: [ String, Number ],
23
+ default: "primary" // primary|secondary|outline, default:primary
24
+ },
25
+
26
+ size: {
27
+ type: [ String ],
28
+ default: '' // sm|md|lg, default: md
29
+ },
30
+
31
+ spacing: {
32
+ type: [ String, Number ],
33
+ default: '' // 0|1|2|3, default: 2
34
+ },
35
+
36
+ state: {
37
+ type: [ String, Number ],
38
+ default: 1
39
+ }, // -1:disabled, 1:normal, 2:loading, default: normal
40
+
41
+ },
42
+
43
+ computed:{
44
+
45
+ computedClass(){
46
+
47
+ return [
48
+ this.$style.button,
49
+ this.$style['variant-' + this.variant],
50
+ this.$style['size-' + this.size],
51
+ this.$style['spacing-' + this.spacing],
52
+ parseInt(this.computedState) === 2 ? this.$style.loading : '',
53
+ ]
54
+ .join(' ')
55
+ },
56
+
57
+ isDisabled(){
58
+ return parseInt(this.computedState) !== 1
59
+ },
60
+
61
+ isLoading(){
62
+ return parseInt(this.computedState) === 2
63
+ },
64
+
65
+ computedState(){
66
+ return this.state ?? this._state
67
+ }
68
+
69
+ },
70
+
71
+ data(){
72
+ return {
73
+ _state: null
74
+ }
75
+ },
76
+
77
+ methods:{
78
+
79
+ focus(){
80
+ this.$el.focus()
81
+ },
82
+
83
+ setState(state){
84
+ console.log('setState', state)
85
+ this._state = state
86
+ }
87
+
88
+ }
89
+
90
+ }
91
+
92
+ </script>
93
+
94
+ <style module>
95
+
96
+ .button{
97
+ @apply h-[var(--h-cp)];
98
+ @apply relative flex items-center justify-center;
99
+ @apply whitespace-nowrap text-ellipsis overflow-hidden;
100
+ @apply rounded-lg;
101
+ }
102
+ .button>*:first-child{
103
+ @apply flex items-center justify-center
104
+ }
105
+ .button:disabled{
106
+ @apply opacity-50;
107
+ }
108
+
109
+ .size-sm{
110
+ @apply h-[var(--h-cp-sm)];
111
+ }
112
+ .size-lg{
113
+ @apply h-[var(--h-cp-lg)];
114
+ }
115
+
116
+ .variant-,
117
+ .variant-primary{
118
+ @apply bg-primary-500 text-white border-[2px] border-primary-500;
119
+ }
120
+ .variant-:hover,
121
+ .variant-primary:hover{
122
+ @apply bg-primary-600 border-primary-600;
123
+ }
124
+ .variant-:active,
125
+ .variant-primary:active{
126
+ @apply top-[1px] left-[1px] relative;
127
+ }
128
+ .variant-:disabled,
129
+ .variant-primary:disabled{
130
+ @apply top-0 left-0 cursor-not-allowed;
131
+ }
132
+ .variant- *,
133
+ .variant-primary *{
134
+ @apply text-white fill-white;
135
+ }
136
+ .variant-.loading *,
137
+ .variant-primary.loading *{
138
+ @apply fill-transparent
139
+ }
140
+ .variant- .svgBg,
141
+ .variant-primary .svgBg{
142
+ stroke: #fff;
143
+ stroke-opacity: 25%;
144
+ }
145
+ .variant- .svgHg,
146
+ .variant-primary .svgHg{
147
+ fill: #fff;
148
+ fill-opacity: 75%;
149
+ }
150
+
151
+ .variant-outline{
152
+ @apply bg-transparent text-primary-500 border-[2px] border-primary-500;
153
+ }
154
+ .variant-outline:hover{
155
+ @apply border-primary-300 text-primary-300;
156
+ }
157
+ .variant-outline:active{
158
+ @apply top-[1px] left-[1px] active:relative;
159
+ }
160
+ .variant-outline:disabled{
161
+ @apply opacity-50 top-0 left-0 cursor-not-allowed;
162
+ @apply text-primary-500 border-primary-500;
163
+ }
164
+ .variant-outline *{
165
+ @apply text-primary-500 fill-primary-500;
166
+ }
167
+ .variant-outline.loading *{
168
+ @apply fill-transparent
169
+ }
170
+ .variant-outline .svgBg{
171
+ stroke: var(--primary);
172
+ stroke-opacity: 25%;
173
+ }
174
+ .variant-outline .svgHg{
175
+ fill: var(--primary);
176
+ fill-opacity: 75%;
177
+ }
178
+
179
+ .variant-secondary{
180
+ @apply bg-secondary text-primary rounded-md border-[2px] border-secondary;
181
+ }
182
+ .variant-secondary:hover{
183
+ @apply bg-secondary-600 border-secondary-600;
184
+ }
185
+ .variant-secondary:active{
186
+ @apply top-[1px] left-[1px] relative;
187
+ }
188
+ .variant-secondary:disabled{
189
+ @apply bg-secondary-500 border-secondary-500 opacity-50 top-0 left-0 cursor-not-allowed;
190
+ }
191
+ .variant-secondary *{
192
+ @apply text-primary fill-primary;
193
+ }
194
+ .variant-secondary.loading *{
195
+ @apply fill-transparent
196
+ }
197
+ .variant-secondary .svgBg{
198
+ stroke: var(--text);
199
+ stroke-opacity: 25%;
200
+ }
201
+ .variant-secondary .svgHg{
202
+ fill: #fff;
203
+ fill-opacity: 75%;
204
+ }
205
+
206
+ .variant-minimal{
207
+ @apply border-[2px] border-transparent;
208
+ }
209
+ .variant-minimal:hover{
210
+ }
211
+ .variant-minimal .svgBg{
212
+ stroke: var(--base-500);
213
+ stroke-opacity: 25%;
214
+ }
215
+ .variant-minimal .svgHg{
216
+ fill: var(--text);
217
+ fill-opacity: 75%;
218
+ }
219
+
220
+ .loadingPane{
221
+ @apply absolute left-0 top-0 right-0 bottom-0 flex items-center justify-center pl-1;
222
+ }
223
+ .loading>*:first-child{
224
+ @apply opacity-0
225
+ }
226
+ .loading:hover{
227
+ }
228
+ .loading:active{
229
+ @apply top-0 left-0;
230
+ }
231
+ .loading>*{
232
+ opacity: 0;
233
+ }
234
+ .loading .loadingPane{
235
+ opacity: 1;
236
+ }
237
+
238
+ .spacing-,
239
+ .spacing-2{
240
+ @apply p-2
241
+ }
242
+ .spacing-1{
243
+ @apply p-1
244
+ }
245
+ .spacing-3{
246
+ @apply p-3
247
+ }
248
+
249
+ .spinner{
250
+ @apply animate-spin h-5 w-5;
251
+ }
252
+
253
+ </style>
@@ -0,0 +1,101 @@
1
+ <template>
2
+ <div class="button-group">
3
+ <div class="flex items-center" @click="showPopup">
4
+ <div class="flex-1">
5
+ {{ text }}
6
+ </div>
7
+ <div>
8
+ <slot name="icon"></slot>
9
+ </div>
10
+ </div>
11
+ <div class="bg-popup">
12
+ <slot></slot>
13
+ </div>
14
+ </div>
15
+ </template>
16
+
17
+ <script>
18
+
19
+ export default {
20
+
21
+ name: "ButtonGroup",
22
+
23
+ props: {
24
+ text: {
25
+ type: String,
26
+ default: ""
27
+ },
28
+ anchor: {
29
+ type: String,
30
+ default: "left"
31
+ }
32
+ },
33
+
34
+ methods: {
35
+
36
+ hidePopup(){
37
+
38
+ const popup = this.$el.querySelector('.bg-popup')
39
+ const transitionEnd = () => {
40
+ popup.classList.remove('on')
41
+ popup.removeEventListener('transitionend', transitionEnd)
42
+ window.removeEventListener('click', this.hidePopup)
43
+ }
44
+
45
+ popup.addEventListener('transitionend', transitionEnd)
46
+ popup.classList.remove('active')
47
+
48
+ },
49
+
50
+ showPopup(e){
51
+
52
+ e.preventDefault()
53
+ e.stopPropagation()
54
+
55
+ const popup = this.$el.querySelector('.bg-popup')
56
+ popup.style.top = (this.$el.clientHeight + 10) + "px"
57
+ popup.style.left = this.anchor === 'left' ? 0 : ''
58
+ popup.style.right = this.anchor === 'right' ? 0 : ''
59
+ popup.classList.add('on')
60
+
61
+ window.setTimeout(() => {
62
+ popup.classList.add('active')
63
+ }, 100)
64
+
65
+ window.addEventListener('click', this.hidePopup)
66
+ }
67
+
68
+ }
69
+
70
+ }
71
+
72
+ </script>
73
+
74
+ <style>
75
+
76
+ .button-group{
77
+ position: relative;
78
+ @apply inline-block;
79
+ @apply cursor-pointer;
80
+ }
81
+
82
+ .bg-popup{
83
+ display: none;
84
+ position: absolute;
85
+ background: #fff;
86
+ }
87
+ .bg-popup.on{
88
+ display: block;
89
+ opacity: 0;
90
+ transform: translate3d(0, -10%, 0);
91
+ transition: all 200ms cubic-bezier(0.25, 1, 0.5, 1);
92
+ }
93
+ .bg-popup.active {
94
+ opacity: 1;
95
+ transform: translate3d(0, 0, 0);
96
+ }
97
+ .bg-popup button{
98
+ white-space: nowrap;
99
+ }
100
+
101
+ </style>