@mixd-id/web-scaffold 0.1.240411028 → 0.1.240411029

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.
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.240411028",
4
+ "version": "0.1.240411029",
5
5
  "scripts": {
6
6
  "dev": "vite serve",
7
7
  "build": "vite build",
@@ -177,6 +177,17 @@ export default {
177
177
  left = Math.round(rect.x)
178
178
  top = Math.round(rect.y + rect.height)
179
179
  transformOrigin = 'top left'
180
+ maxHeight = window.innerHeight - top - 16
181
+ this.transition = 'slidedown'
182
+
183
+ if(top > window.innerHeight * .8){
184
+ top = null
185
+ bottom = window.innerHeight - rect.top + 8
186
+ transformOrigin = 'bottom'
187
+ maxHeight = Math.round(rect.top - 16)
188
+ console.log('maxHeight', maxHeight)
189
+ this.transition = 'slideup'
190
+ }
180
191
  break
181
192
  }
182
193
 
@@ -234,7 +245,7 @@ export default {
234
245
 
235
246
  .contextMenu{
236
247
  @apply fixed bg-base-300 min-w-[150px] overflow-y-auto rounded-xl z-50;
237
- @apply whitespace-nowrap shadow-2xl border-[1px] border-text-50 mt-[1px];
248
+ @apply whitespace-nowrap shadow-2xl border-[1px] border-text-200 mt-[1px];
238
249
  }
239
250
 
240
251
  @media screen and (min-width: 640px){
@@ -0,0 +1,88 @@
1
+ <template>
2
+ <ContextMenu ref="contextMenu" class="mt-1">
3
+ <div class="flex flex-col min-w-[200px]">
4
+
5
+ <div class="p-1 sticky top-0 bg-base-500" @click.stop>
6
+ <Textbox :clearable="true" @clear="search = ''" placeholder="Search or add..." v-model="search" />
7
+ </div>
8
+
9
+ <button v-if="viewedItems.length > 0" v-for="text in viewedItems" class="w-full p-3 text-left flex flex-row menu-item"
10
+ @click="select(text)">
11
+ {{ text }}
12
+ </button>
13
+
14
+ <button v-else-if="search.length > 0" type="button" class="w-full p-3 text-primary" @click="add(search)">
15
+ Tambah {{ search }}
16
+ </button>
17
+
18
+ </div>
19
+ </ContextMenu>
20
+ </template>
21
+
22
+ <script>
23
+ import ContextMenu from "./ContextMenu.vue";
24
+
25
+ export default{
26
+ components: {ContextMenu},
27
+
28
+ emits: [ 'select' ],
29
+
30
+ props: {
31
+ items: Array
32
+ },
33
+
34
+ computed: {
35
+
36
+ viewedItems(){
37
+ return (this.items ?? [])
38
+ .filter(text => {
39
+ return text.toLowerCase().includes(this.search.toLowerCase())
40
+ })
41
+ .sort((a, b) => {
42
+ return a.toLowerCase().localeCompare(b.toLowerCase())
43
+ })
44
+ }
45
+
46
+ },
47
+
48
+ data(){
49
+ return {
50
+ search: '',
51
+ cb: null
52
+ }
53
+ },
54
+
55
+ methods: {
56
+
57
+ add(text){
58
+ if(`${text}`.length < 1) return
59
+
60
+ this.items.push(text)
61
+ this.select(text)
62
+ },
63
+
64
+ select(text){
65
+ this.$emit('select', text)
66
+ if(typeof this.cb === 'function')
67
+ this.cb(text)
68
+ },
69
+
70
+ open(caller, cb){
71
+ this.search = ''
72
+ this.cb = cb
73
+ this.$refs.contextMenu.open(caller)
74
+ }
75
+
76
+ }
77
+
78
+ }
79
+
80
+ </script>
81
+
82
+ <style module>
83
+
84
+ .comp{
85
+
86
+ }
87
+
88
+ </style>
@@ -74,6 +74,7 @@ export default{
74
74
  this.$style.textbox,
75
75
  this.$style['state-' + this.computedState],
76
76
  this.readonly ? this.$style.readonly : '',
77
+ this.disabled ? this.$style.disabled : '',
77
78
  this.isActive && !this.readonly ? this.$style.active : '',
78
79
  this.align ? this.$style['align-' + this.align] : '',
79
80
  this.size ? this.$style['size-' + this.size] : ''
@@ -186,7 +187,6 @@ export default{
186
187
  }
187
188
 
188
189
  .textbox.readonly{
189
- @apply bg-text-50;
190
190
  }
191
191
 
192
192
  .size-sm input{ @apply text-sm; }
package/src/index.js CHANGED
@@ -489,6 +489,7 @@ export default{
489
489
  app.component('MultiDropdown', defineAsyncComponent(() => import("./components/MultiDropdown.vue")))
490
490
  app.component('Carousel', defineAsyncComponent(() => import("./components/Carousel.vue")))
491
491
  app.component('ContextMenu', defineAsyncComponent(() => import("./components/ContextMenu.vue")))
492
+ app.component('ListContextMenu', defineAsyncComponent(() => import("./components/ListContextMenu.vue")))
492
493
  app.component('FAQ', defineAsyncComponent(() => import("./widgets/FAQ.vue")))
493
494
  app.component('Flex', defineAsyncComponent(() => import("./components/Flex.vue")))
494
495
  app.component('Grid', defineAsyncComponent(() => import("./components/Grid.vue")))