@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
@@ -0,0 +1,261 @@
1
+ <template>
2
+ <Teleport to=".Y29u">
3
+ <div v-if="!!(computedState)" :class="$style.contextMenu" :style="computedStyle" ref="contextMenu">
4
+ <div :class="bodyClass">
5
+ <slot name="default" :context="context"></slot>
6
+ </div>
7
+ </div>
8
+ </Teleport>
9
+ </template>
10
+
11
+ <script>
12
+
13
+ export default {
14
+
15
+ props:{
16
+
17
+ state: {
18
+ type: Boolean,
19
+ default: false
20
+ },
21
+
22
+ caller:{
23
+ type: Object
24
+ },
25
+
26
+ class: String,
27
+
28
+ position: {
29
+ type: String,
30
+ default: "auto" // bottom-left, bottom-right, top-left, top-right, bottom-center, top-center default: bottom-left
31
+ },
32
+
33
+ bodyClass: String,
34
+
35
+ dismiss: {
36
+ type: Boolean,
37
+ default: true
38
+ }
39
+
40
+ },
41
+
42
+ emits: [
43
+ 'dismiss',
44
+ 'open'
45
+ ],
46
+
47
+ computed:{
48
+
49
+ computedState(){
50
+ return this.state || this.isOpen
51
+ }
52
+
53
+ },
54
+
55
+ data(){
56
+ return {
57
+ computedStyle: null,
58
+ isOpen: false,
59
+ context: null,
60
+ closing: false
61
+ }
62
+ },
63
+
64
+ watch: {
65
+
66
+ state(to){
67
+ if(to){
68
+ this.open()
69
+ }
70
+ else{
71
+ window.removeEventListener('click', this.onDismiss)
72
+ window.removeEventListener('scroll', this.onDismiss)
73
+ }
74
+ }
75
+
76
+ },
77
+
78
+ methods: {
79
+
80
+ onOpen(){
81
+ if(typeof window === 'undefined') return
82
+
83
+ const transitionEnd = () => {
84
+ window.addEventListener('click', this.onDismiss)
85
+ window.addEventListener('scroll', this.onDismiss)
86
+ this.$refs.contextMenu.removeEventListener('transitionend', transitionEnd)
87
+ this.$emit('open')
88
+ }
89
+
90
+ this.$refs.contextMenu.removeEventListener('transitionend', transitionEnd)
91
+ this.$refs.contextMenu.addEventListener('transitionend', transitionEnd)
92
+ this.$nextTick(() => {
93
+ this.$refs.contextMenu.classList.add(this.$style.active)
94
+ })
95
+ },
96
+
97
+ onDismiss(e){
98
+ if(typeof window === 'undefined') return
99
+ if(!this.$refs.contextMenu) return
100
+
101
+ if(e.target.closest('.' + this.$style.contextMenu) && !this.dismiss)
102
+ return
103
+
104
+ this.close()
105
+ },
106
+
107
+ open(caller, context){
108
+
109
+ if(this.isOpen){
110
+ return this.close(() => {
111
+ window.setTimeout(() => {
112
+ this.open(caller, context)
113
+ }, 30)
114
+ })
115
+ }
116
+
117
+ if(caller){
118
+ this.isOpen = true
119
+ }
120
+
121
+ caller = caller ?? this.caller
122
+
123
+ if(caller){
124
+
125
+ caller = caller.$el ? caller.$el :
126
+ caller instanceof HTMLElement ? caller : null
127
+
128
+ this.context = context
129
+
130
+ if(caller){
131
+
132
+ this.$nextTick(() => {
133
+ const rect = caller.getBoundingClientRect()
134
+
135
+ let maxHeight
136
+ let top, right, bottom, left
137
+ let transformOrigin
138
+
139
+ switch(this.position){
140
+
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
147
+
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'){
175
+ transformOrigin = 'top right'
176
+ }
177
+ }
178
+ }
179
+
180
+ if(top){
181
+ if(top + this.$refs.contextMenu.clientHeight >= (window.innerHeight - 16)){
182
+ top = window.innerHeight - (this.$refs.contextMenu.clientHeight + 16)
183
+
184
+ if(transformOrigin === 'top left'){
185
+ transformOrigin = 'bottom left'
186
+ }
187
+ else if(transformOrigin === 'top right'){
188
+ transformOrigin = 'bottom right'
189
+ }
190
+ }
191
+
192
+ if(top < 0){
193
+ top = 0
194
+ }
195
+ }
196
+
197
+ maxHeight = this.$refs.contextMenu.clientHeight > window.innerHeight * .8 ?
198
+ Math.round(window.innerHeight * .8) : this.$refs.contextMenu.clientHeight + 24
199
+
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
+ }
208
+
209
+ this.onOpen()
210
+ })
211
+
212
+ }
213
+ else{
214
+ console.error('Undefined caller for context menu')
215
+ }
216
+ }
217
+ else{
218
+ console.warn('Invalid context menu caller', this.caller)
219
+ }
220
+ },
221
+
222
+ close(fn){
223
+ const transitionEnd = () => {
224
+ window.removeEventListener('click', this.onDismiss)
225
+ window.removeEventListener('scroll', this.onDismiss)
226
+ if(this.$refs.contextMenu){
227
+ this.$refs.contextMenu.removeEventListener('transitionend', transitionEnd)
228
+ this.computedStyle = {}
229
+ }
230
+ this.computedStyle = null
231
+ this.isOpen = false
232
+ this.$emit('dismiss')
233
+ if(fn) fn()
234
+ }
235
+ this.$refs.contextMenu.removeEventListener('transitionend', transitionEnd)
236
+ this.$refs.contextMenu.addEventListener('transitionend', transitionEnd)
237
+ this.$refs.contextMenu.classList.remove(this.$style.active)
238
+ }
239
+
240
+ }
241
+
242
+ }
243
+
244
+ </script>
245
+
246
+ <style module>
247
+
248
+ .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;
251
+ transition: all 150ms cubic-bezier(0.25, 1, 0.5, 1);
252
+ opacity: 0;
253
+ transform: scale(.3);
254
+ }
255
+
256
+ .active{
257
+ opacity: 1;
258
+ transform: scale(1);
259
+ }
260
+
261
+ </style>
@@ -0,0 +1,59 @@
1
+ <template>
2
+ <button @click="copyToClipboard">
3
+ <slot></slot>
4
+ </button>
5
+ </template>
6
+
7
+ <script>
8
+
9
+ export default{
10
+
11
+ emits: [ 'copied', 'error' ],
12
+
13
+ props: {
14
+ value: {
15
+ type: undefined,
16
+ required: true
17
+ }
18
+ },
19
+
20
+ methods: {
21
+
22
+ fallbackCopyTextToClipboard(text){
23
+ var textArea = document.createElement("textarea");
24
+ textArea.value = this.value;
25
+ textArea.style.top = "0";
26
+ textArea.style.left = "0";
27
+ textArea.style.position = "fixed";
28
+ document.body.appendChild(textArea);
29
+ textArea.focus();
30
+ textArea.select();
31
+
32
+ try {
33
+ document.execCommand('copy')
34
+ this.$emit('copied')
35
+ } catch (err) {
36
+ this.$emit('error')
37
+ }
38
+
39
+ document.body.removeChild(textArea);
40
+ },
41
+
42
+ copyToClipboard(){
43
+
44
+ if (!navigator.clipboard) {
45
+ this.fallbackCopyTextToClipboard(this.value);
46
+ return;
47
+ }
48
+ navigator.clipboard.writeText(this.value).then(() => {
49
+ this.$emit('copied')
50
+ }, (err) => {
51
+ this.$emit('error')
52
+ });
53
+ }
54
+
55
+ }
56
+
57
+ }
58
+
59
+ </script>
@@ -0,0 +1,213 @@
1
+ <template>
2
+ <div :class="$style.comp">
3
+
4
+ <slot v-if="display >= 4 && $slots.day" name="day" :day="day"></slot>
5
+ <div ref="day" v-else-if="display >= 4" :class="$style.lap">
6
+ <div></div>
7
+ <div></div>
8
+ </div>
9
+
10
+ <slot v-if="display >= 3 && $slots.hour" name="hour" :hour="hour"></slot>
11
+ <div ref="hour" v-else-if="display >= 3" :class="$style.lap">
12
+ <div></div>
13
+ <div></div>
14
+ </div>
15
+
16
+ <div>:</div>
17
+
18
+ <slot v-if="display >= 2 && $slots.minute" name="minute" :minute="minute"></slot>
19
+ <div ref="minute" v-else-if="display >= 2" :class="$style.lap">
20
+ <div></div>
21
+ <div></div>
22
+ </div>
23
+
24
+ <div>:</div>
25
+
26
+ <slot v-if="display >= 1 && $slots.second" name="second" :second="second"></slot>
27
+ <div ref="second" v-else-if="display >= 1" :class="$style.lap">
28
+ <div></div>
29
+ <div></div>
30
+ </div>
31
+
32
+ </div>
33
+ </template>
34
+
35
+ <script>
36
+
37
+ import debounce from "lodash/debounce";
38
+
39
+ export default{
40
+
41
+ props: {
42
+
43
+ display: {
44
+ type: [ String, Number ], // default: 3
45
+ default: 3
46
+ },
47
+
48
+ value: [ String, Number ] // value in second
49
+
50
+ },
51
+
52
+ computed:{
53
+
54
+ day(){
55
+ return Math.floor(this.timer / 86400).toString().padStart(2, '0')
56
+ },
57
+
58
+ hour(){
59
+ return (Math.floor(this.timer / 3600) % 24).toString().padStart(2, '0')
60
+ },
61
+
62
+ minute(){
63
+ return (Math.floor(this.timer / 60) % 60).toString().padStart(2, '0')
64
+ },
65
+
66
+ second(){
67
+ return (this.timer % 60).toString().padStart(2, '0')
68
+ }
69
+
70
+ },
71
+
72
+ data(){
73
+ return {
74
+ timer: null,
75
+ timeoutId: null,
76
+ beforeSecond: null,
77
+ afterSecond: null,
78
+ tick: false
79
+ }
80
+ },
81
+
82
+ mounted() {
83
+ this.start()
84
+
85
+ if(this.$refs.second) this.$refs.second.addEventListener('transitionend', this.onSecondEnd)
86
+ if(this.$refs.minute) this.$refs.minute.addEventListener('transitionend', this.onMinuteEnd)
87
+ if(this.$refs.hour) this.$refs.hour.addEventListener('transitionend', this.onHourEnd)
88
+ if(this.$refs.day) this.$refs.day.addEventListener('transitionend', this.onDayEnd)
89
+ },
90
+
91
+ methods: {
92
+
93
+ onSecondEnd: debounce(function (e){
94
+ this.$refs.second.insertBefore(this.$refs.second.childNodes[1], this.$refs.second.childNodes[0])
95
+ this.$refs.second.classList.remove(this.$style.tick)
96
+ this.$refs.second.childNodes[0].innerHTML = ''
97
+ }, 100),
98
+
99
+ onMinuteEnd: debounce(function (e){
100
+ this.$refs.minute.insertBefore(this.$refs.minute.childNodes[1], this.$refs.minute.childNodes[0])
101
+ this.$refs.minute.classList.remove(this.$style.tick)
102
+ this.$refs.minute.childNodes[0].innerHTML = ''
103
+ }, 100),
104
+
105
+ onHourEnd: debounce(function (e){
106
+ this.$refs.hour.insertBefore(this.$refs.hour.childNodes[1], this.$refs.hour.childNodes[0])
107
+ this.$refs.hour.classList.remove(this.$style.tick)
108
+ this.$refs.hour.childNodes[0].innerHTML = ''
109
+ }, 100),
110
+
111
+ onDayEnd: debounce(function (e){
112
+ this.$refs.day.insertBefore(this.$refs.day.childNodes[1], this.$refs.day.childNodes[0])
113
+ this.$refs.day.classList.remove(this.$style.tick)
114
+ this.$refs.day.childNodes[0].innerHTML = ''
115
+ }, 100),
116
+
117
+ setInitial(){
118
+ if(this.$refs.day) this.$refs.day.lastElementChild.innerHTML = '1 hari'
119
+ if(this.$refs.hour) this.$refs.hour.lastElementChild.innerHTML = (Math.floor(this.timer / 3600) % 24).toString().padStart(2, '0')
120
+ if(this.$refs.minute) this.$refs.minute.lastElementChild.innerHTML = (Math.floor(this.timer / 60) % 60).toString().padStart(2, '0')
121
+ if(this.$refs.second) this.$refs.second.lastElementChild.innerHTML = (this.timer % 60).toString().padStart(2, '0')
122
+ },
123
+
124
+ start(){
125
+
126
+ this.timer = this.value
127
+
128
+ this.setInitial()
129
+
130
+ this.timeoutId = window.setInterval(() => {
131
+ this.timer--
132
+ this.tick = true
133
+
134
+ if(this.timer <= 0){
135
+ window.clearTimeout(this.timeoutId)
136
+ }
137
+ }, 1000)
138
+ }
139
+
140
+ },
141
+
142
+ watch: {
143
+
144
+ value(to){
145
+ this.start()
146
+ },
147
+
148
+ day(to, from){
149
+ if(!this.tick || !this.$refs.day) return
150
+ this.$refs.day.firstElementChild.innerHTML = to > 0 ? to + ' hari' : ''
151
+ this.$refs.day.lastElementChild.innerHTML = from + ' hari'
152
+ this.$refs.day.classList.add(this.$style.tick)
153
+ },
154
+
155
+ hour(to, from){
156
+ if(!this.tick) return
157
+ this.$refs.hour.firstElementChild.innerHTML = to
158
+ this.$refs.hour.lastElementChild.innerHTML = from
159
+ this.$refs.hour.classList.add(this.$style.tick)
160
+ },
161
+
162
+ minute(to, from){
163
+ if(!this.tick) return
164
+ this.$refs.minute.firstElementChild.innerHTML = to
165
+ this.$refs.minute.lastElementChild.innerHTML = from
166
+ this.$refs.minute.classList.add(this.$style.tick)
167
+ },
168
+
169
+ second(to, from){
170
+ if(!this.tick) return
171
+ this.$refs.second.firstElementChild.innerHTML = to
172
+ this.$refs.second.lastElementChild.innerHTML = from
173
+ this.$refs.second.classList.add(this.$style.tick)
174
+ }
175
+ }
176
+
177
+ }
178
+
179
+ </script>
180
+
181
+ <style module>
182
+
183
+ .comp{
184
+ @apply flex flex-row gap-2;
185
+ }
186
+
187
+ .lap{
188
+ @apply relative overflow-hidden bg-gray-200 min-w-[1.8rem] rounded-lg text-center;
189
+ }
190
+ .lap>*{
191
+ @apply whitespace-nowrap font-bold;
192
+ }
193
+ .lap>*:first-child{
194
+ @apply absolute top-0 left-0 right-0 text-center;
195
+ transform: translate3d(0, -1.3rem, 0);
196
+ }
197
+ .lap>*:last-child{
198
+ transform: translate3d(0, 0, 0);
199
+ }
200
+
201
+ .tick{
202
+ }
203
+ .tick>*{
204
+ transition: transform 300ms ease;
205
+ }
206
+ .tick>*:first-child{
207
+ transform: translate3d(0, 0, 0);
208
+ }
209
+ .tick>*:last-child{
210
+ transform: translate3d(0, 1.3rem, 0);
211
+ }
212
+
213
+ </style>